diff --git a/docs/tutorial/t-deploy-mongodb.md b/docs/tutorial/t-deploy-mongodb.md index bdee22632..8f4ddadec 100644 --- a/docs/tutorial/t-deploy-mongodb.md +++ b/docs/tutorial/t-deploy-mongodb.md @@ -6,7 +6,7 @@ This is part of the [Charmed MongoDB Tutorial](/t/charmed-mongodb-tutorial/8061) To deploy Charmed MongoDB, all you need to do is run the following command, which will fetch the charm from [Charmhub](https://charmhub.io/mongodb?channel=5/edge) and deploy it to your model: ```shell -juju deploy mongodb --channel 6/edge +juju deploy mongodb --channel 5/edge ``` Juju will now fetch Charmed MongoDB and begin deploying it to the LXD cloud. This process can take several minutes depending on how provisioned (RAM, CPU,etc) your machine is. You can track the progress by running: @@ -33,7 +33,7 @@ To exit the screen with `juju status --watch 1s`, enter `Ctrl+c`. ## Access MongoDB > **!** *Disclaimer: this part of the tutorial accesses MongoDB via the `admin` user. **Do not** directly interface with the admin user in a production environment. In a production environment [always create a separate user](https://www.mongodb.com/docs/manual/tutorial/create-users/) and connect to MongoDB with that user instead. Later in the section covering Relations we will cover how to access MongoDB without the admin user.* -The first action most users take after installing MongoDB is accessing MongoDB. The easiest way to do this is via the MongoDB shell, with `mongosh`. You can read more about the MongoDB shell [here](https://www.mongodb.com/docs/mongodb-shell/). For this part of the Tutorial we will access MongoDB via `mongosh`. Fortunately there is no need to install the Mongo shell, as `mongosj` is already installed on the units hosting the Charmed MongoDB application as `charmed-mongodb.mongosh`. +The first action most users take after installing MongoDB is accessing MongoDB. The easiest way to do this is via the MongoDB shell, with `mongo`. You can read more about the MongoDB shell [here](https://www.mongodb.com/docs/mongodb-shell/). For this part of the Tutorial we will access MongoDB via `mongo`. Fortunately there is no need to install the Mongo shell, as `mongo` is already installed on the units hosting the Charmed MongoDB application as `charmed-mongodb.mongo`. ### MongoDB URI Connecting to the database requires a Uniform Resource Identifier (URI), MongoDB expects a [MongoDB specific URI](https://www.mongodb.com/docs/manual/reference/connection-string/). The URI for MongoDB contains information which is used to authenticate us to the database. We use a URI of the format: @@ -101,7 +101,7 @@ export REPL_SET_NAME="mongodb" ``` ### Generate the MongoDB URI -Now that we have the necessary fields to connect to the URI, we can connect to MongoDB with `charmed-mongodb.mongosh` via the URI. We can create the URI with: +Now that we have the necessary fields to connect to the URI, we can connect to MongoDB with `charmed-mongodb.mongo` via the URI. We can create the URI with: ```shell export URI=mongodb://$DB_USERNAME:$DB_PASSWORD@$HOST_IP/$DB_NAME?replicaSet=$REPL_SET_NAME ``` @@ -111,16 +111,16 @@ echo $URI ``` ### Connect via MongoDB URI -As said earlier, `mongosh` is already installed in Charmed MongoDB as `charmed-mongodb.mongosh`. To access the unit hosting Charmed MongoDB, ssh into it: +As said earlier, `mongo` is already installed in Charmed MongoDB as `charmed-mongodb.mongo`. To access the unit hosting Charmed MongoDB, ssh into it: ```shell juju ssh mongodb/0 ``` *Note if at any point you'd like to leave the unit hosting Charmed MongoDB, enter* `exit`. -While `ssh`d into `mongodb/0`, we can access `mongosh`, using the URI that we saved in the step [Generate the MongoDB URI](#generate-the-mongodb-uri). +While `ssh`d into `mongodb/0`, we can access `mongo`, using the URI that we saved in the step [Generate the MongoDB URI](#generate-the-mongodb-uri). ```shell -charmed-mongodb.mongosh +charmed-mongodb.mongo ``` You should now see: diff --git a/docs/tutorial/t-managing-units.md b/docs/tutorial/t-managing-units.md index 47eaf5771..7397dfb0a 100644 --- a/docs/tutorial/t-managing-units.md +++ b/docs/tutorial/t-managing-units.md @@ -34,7 +34,7 @@ Machine State Address Inst id Series AZ Message 2 started 10.23.62.243 juju-d35d30-2 jammy Running ``` -You can trust that Charmed MongoDB added these replicas correctly. But if you wanted to verify the replicas got added correctly you could connect to MongoDB via `charmed-mongodb.mongosh`. Since your replica set has 2 additional hosts you will need to update the hosts in your URI. You can retrieve these host IPs with: +You can trust that Charmed MongoDB added these replicas correctly. But if you wanted to verify the replicas got added correctly you could connect to MongoDB via `charmed-mongodb.mongo`. Since your replica set has 2 additional hosts you will need to update the hosts in your URI. You can retrieve these host IPs with: ```shell export HOST_IP_1=$(juju run --unit mongodb/1 -- hostname -I | xargs) export HOST_IP_2=$(juju run --unit mongodb/2 -- hostname -I | xargs) @@ -50,23 +50,23 @@ Now view and save the output of the URI: echo $URI ``` -Like earlier we access `mongosh` by `ssh`ing into one of the Charmed MongoDB hosts: +Like earlier we access `mongo` by `ssh`ing into one of the Charmed MongoDB hosts: ```shell juju ssh mongodb/0 ``` -While `ssh`d into `mongodb/0`, we can access `mongosh` with `charmed-mongodb.mongosh`, using our new URI that we saved above. +While `ssh`d into `mongodb/0`, we can access `mongo` with `charmed-mongodb.mongo`, using our new URI that we saved above. ```shell -charmed-mongodb.mongosh +charmed-mongodb.mongo ``` Now type `rs.status()` and you should see your replica set configuration. It should look something like this: ```json { set: 'mongodb', - date: ISODate("2023-09-21T10:19:56.666Z"), + date: ISODate("2022-12-02T14:39:52.732Z"), myState: 1, - term: Long("8"), + term: Long("1"), syncSourceHost: '', syncSourceId: -1, heartbeatIntervalMillis: Long("2000"), @@ -75,106 +75,105 @@ Now type `rs.status()` and you should see your replica set configuration. It sho votingMembersCount: 3, writableVotingMembersCount: 3, optimes: { - lastCommittedOpTime: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - lastCommittedWallTime: ISODate("2023-09-21T10:19:53.387Z"), - readConcernMajorityOpTime: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - appliedOpTime: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - durableOpTime: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - lastAppliedWallTime: ISODate("2023-09-21T10:19:53.387Z"), - lastDurableWallTime: ISODate("2023-09-21T10:19:53.387Z") + lastCommittedOpTime: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + lastCommittedWallTime: ISODate("2022-12-02T14:39:50.020Z"), + readConcernMajorityOpTime: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + appliedOpTime: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + durableOpTime: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + lastAppliedWallTime: ISODate("2022-12-02T14:39:50.020Z"), + lastDurableWallTime: ISODate("2022-12-02T14:39:50.020Z") }, - lastStableRecoveryTimestamp: Timestamp({ t: 1695291546, i: 2 }), + lastStableRecoveryTimestamp: Timestamp({ t: 1669991950, i: 1 }), electionCandidateMetrics: { lastElectionReason: 'electionTimeout', - lastElectionDate: ISODate("2023-09-21T09:57:28.251Z"), - electionTerm: Long("8"), - lastCommittedOpTimeAtElection: { ts: Timestamp({ t: 0, i: 0 }), t: Long("-1") }, - lastSeenOpTimeAtElection: { ts: Timestamp({ t: 1695290223, i: 4 }), t: Long("7") }, - numVotesNeeded: 2, + lastElectionDate: ISODate("2022-12-02T11:24:09.587Z"), + electionTerm: Long("1"), + lastCommittedOpTimeAtElection: { ts: Timestamp({ t: 1669980249, i: 1 }), t: Long("-1") }, + lastSeenOpTimeAtElection: { ts: Timestamp({ t: 1669980249, i: 1 }), t: Long("-1") }, + numVotesNeeded: 1, priorityAtElection: 1, electionTimeoutMillis: Long("10000"), - numCatchUpOps: Long("0"), - newTermStartDate: ISODate("2023-09-21T09:57:28.258Z"), - wMajorityWriteAvailabilityDate: ISODate("2023-09-21T09:57:28.810Z") + newTermStartDate: ISODate("2022-12-02T11:24:09.630Z"), + wMajorityWriteAvailabilityDate: ISODate("2022-12-02T11:24:09.651Z") }, members: [ { _id: 0, - name: '10.165.186.135:27017', + name: '10.23.62.156:27017', health: 1, state: 1, stateStr: 'PRIMARY', - uptime: 1371, - optime: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - optimeDate: ISODate("2023-09-21T10:19:53.000Z"), - lastAppliedWallTime: ISODate("2023-09-21T10:19:53.387Z"), - lastDurableWallTime: ISODate("2023-09-21T10:19:53.387Z"), + uptime: 11747, + optime: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + optimeDate: ISODate("2022-12-02T14:39:50.000Z"), + lastAppliedWallTime: ISODate("2022-12-02T14:39:50.020Z"), + lastDurableWallTime: ISODate("2022-12-02T14:39:50.020Z"), syncSourceHost: '', syncSourceId: -1, infoMessage: '', - electionTime: Timestamp({ t: 1695290248, i: 1 }), - electionDate: ISODate("2023-09-21T09:57:28.000Z"), + electionTime: Timestamp({ t: 1669980249, i: 2 }), + electionDate: ISODate("2022-12-02T11:24:09.000Z"), configVersion: 5, - configTerm: 8, + configTerm: 1, self: true, lastHeartbeatMessage: '' }, { _id: 1, - name: '10.165.186.225:27017', + name: '10.23.62.55:27017', health: 1, state: 2, stateStr: 'SECONDARY', - uptime: 1351, - optime: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - optimeDurable: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - optimeDate: ISODate("2023-09-21T10:19:53.000Z"), - optimeDurableDate: ISODate("2023-09-21T10:19:53.000Z"), - lastAppliedWallTime: ISODate("2023-09-21T10:19:53.387Z"), - lastDurableWallTime: ISODate("2023-09-21T10:19:53.387Z"), - lastHeartbeat: ISODate("2023-09-21T10:19:56.298Z"), - lastHeartbeatRecv: ISODate("2023-09-21T10:19:55.325Z"), + uptime: 305, + optime: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + optimeDurable: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + optimeDate: ISODate("2022-12-02T14:39:50.000Z"), + optimeDurableDate: ISODate("2022-12-02T14:39:50.000Z"), + lastAppliedWallTime: ISODate("2022-12-02T14:39:50.020Z"), + lastDurableWallTime: ISODate("2022-12-02T14:39:50.020Z"), + lastHeartbeat: ISODate("2022-12-02T14:39:51.868Z"), + lastHeartbeatRecv: ISODate("2022-12-02T14:39:51.882Z"), pingMs: Long("0"), lastHeartbeatMessage: '', - syncSourceHost: '10.165.186.135:27017', + syncSourceHost: '10.23.62.156:27017', syncSourceId: 0, infoMessage: '', configVersion: 5, - configTerm: 8 + configTerm: 1 }, { _id: 2, - name: '10.165.186.179:27017', + name: '10.23.62.243:27017', health: 1, state: 2, stateStr: 'SECONDARY', - uptime: 1351, - optime: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - optimeDurable: { ts: Timestamp({ t: 1695291593, i: 4 }), t: Long("8") }, - optimeDate: ISODate("2023-09-21T10:19:53.000Z"), - optimeDurableDate: ISODate("2023-09-21T10:19:53.000Z"), - lastAppliedWallTime: ISODate("2023-09-21T10:19:53.387Z"), - lastDurableWallTime: ISODate("2023-09-21T10:19:53.387Z"), - lastHeartbeat: ISODate("2023-09-21T10:19:56.602Z"), - lastHeartbeatRecv: ISODate("2023-09-21T10:19:55.344Z"), + uptime: 300, + optime: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + optimeDurable: { ts: Timestamp({ t: 1669991990, i: 1 }), t: Long("1") }, + optimeDate: ISODate("2022-12-02T14:39:50.000Z"), + optimeDurableDate: ISODate("2022-12-02T14:39:50.000Z"), + lastAppliedWallTime: ISODate("2022-12-02T14:39:50.020Z"), + lastDurableWallTime: ISODate("2022-12-02T14:39:50.020Z"), + lastHeartbeat: ISODate("2022-12-02T14:39:51.861Z"), + lastHeartbeatRecv: ISODate("2022-12-02T14:39:52.372Z"), pingMs: Long("0"), lastHeartbeatMessage: '', - syncSourceHost: '10.165.186.135:27017', - syncSourceId: 0, + syncSourceHost: '10.23.62.55:27017', + syncSourceId: 1, infoMessage: '', configVersion: 5, - configTerm: 8 + configTerm: 1 } ], ok: 1, '$clusterTime': { - clusterTime: Timestamp({ t: 1695291593, i: 4 }), + clusterTime: Timestamp({ t: 1669991990, i: 1 }), signature: { - hash: Binary.createFromBase64("HiSmynKsjpsdvfJFZemY8q75KVs=", 0), - keyId: Long("7281212693464219655") + hash: Binary(Buffer.from("dbe96e73cf659617bb88b6ad11152551c0dd9c8d", "hex"), 0), + keyId: Long("7172510554420936709") } }, - operationTime: Timestamp({ t: 1695291593, i: 4 }) + operationTime: Timestamp({ t: 1669991990, i: 1 }) } ``` diff --git a/docs/tutorial/t-relate-mongodb.md b/docs/tutorial/t-relate-mongodb.md index 5285fe436..acb869410 100644 --- a/docs/tutorial/t-relate-mongodb.md +++ b/docs/tutorial/t-relate-mongodb.md @@ -74,10 +74,10 @@ Notice that in the previous step when you typed `juju run-action data-integrator ```shell juju ssh mongodb/0 ``` -Then access `mongosh` with the URI that you copied above: +Then access `mongo` with the URI that you copied above: ```shell -charmed-mongodb.mongosh "" +charmed-mongodb.mongo "" ``` ***Note: be sure you wrap the URI in `"` with no trailing whitespace*.**