forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 1
Access Mongodb directly in the VAP
ear-dev edited this page Nov 17, 2021
·
2 revisions
- Access to the VAP using kubectl
- Login creds for mongodb (stored in lastpass)
- Find the mongodb primary pod
kubectl get pods -n chatbot-messaging
- SSH to the mongodb primary pod
kubectl exec -it rocketchat-mongodb-0 /bin/bash -n chatbot-messaging
- Login to the mongo shell
mongo -u root -p <root_password>
use rocketchat
-
show collections
- this will show you all the tables in the db -
db.<collectionName>.find().pretty()
- this will show you all the contents of a designated collection -
db.rocketchat_room.find({ "_id": "<room_id>"}).pretty()
- this will show just the room indicated in the dict
'kubectl exec' (SSH) has a very short timeout period. If you are not active in the window it will close after just a few minutes. I sometimes use a wonky workaround to keep the window open. However it requires that you bounce in and out of the mongo shell if you need some time to look up a mongo command, etc, and you want to keep the SSH session open.
At the top level run:
- { for i in {1..1000}; do echo -n "hello"; sleep 10; done; }
Stupid...... I know......