Upgrade MongoDB to Amazon DB without upgrading AgilitySync
Overview
Follow these instructions step-by-step to Upgrade MongoDB to Amazon DB without upgrading AgilitySync to RHEL 7(Agility Sync on RHEL 7), this can be done with MongoDB on same box or MongoDB on separate Box.
- Create a cluster in Amazon DB using Amazon Web Services(AWS) documentation.
- Assign the current App Box to the Cluster.
- Download the Amazon DocumentDB Certificate Authority (CA) certificate required to authenticate to your App box.
- Check the cluster connection using the mongo shell command given in document DB cluster in AWS.
Create a user in DocumentDB using an encrypted password.
a. Download the backup script to App Server:
cd /tmp
wget \<script.py\>
a. Make it Executable:
chmod +x \<script.py\>
b. Encrypt a password:
./script.py -o encrypt \--encryption_key \"key from agilitysync.yaml
file\" \--password_to_encrypt \"password\"
Make a note of the plain password and the encrypted password.
- Script to add a new user in App box (which will be used for cluster setup):
cd /opt/agilitysync/current/common/install/
./adduser_mongodb.py --adminuser <DocumentDBCluster username> --adminpassword <DocumentDBCluster pwd> --newuser syncuser --newpassword <new encrypted pwd> --replicasetname rs0 --replicasethosts <replicahostname> --sslcacertfile /etc/global-bundle.pem --ssl true
- To take backup of existing Data:
a. Stop Services:
as-stop-services
a. Run the backup script:
cd /tmp
./script.py -o backup -p \</tmp\> -t
(a tar.gz file gets created under the specified path)
- Run the restore script using the below parameters:
./script.py -o restore \--mongo-host \<replicate hostname\>
\--mongo-user syncuser \--mongo-pass \"Mongo User\'s un-encrypted
password\" \--mongo-ssl-ca-certs /etc/global-bundle.pem \--mongo-ssl
true -p \<path to backup tar file\> -t
- Modify the
agilitysync.yaml
vim /etc/agilitysync/agilitysync.yaml
Add Amazon Cluster details like below:
mongodb_replicaset_hosts: \<replicate hostname\>
mongodb_database: agilitysync
mongodb_username: syncuser
mongodb_password: \<Encrypted pwd of the user\>
mongodb_ssl: true
mongodb_ssl_ca_certs: /etc/global-bundle.pem
mongodb_replicaset_name: rs0
mongo_retry_writes: false
mongodb_read_preference: secondaryPreferred
And Save
- Start services:
as-start-services