Guest User

rs-init.sh

a guest
Nov 23rd, 2023
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.47 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "======== Start initiating Replica Set ========"
  4.  
  5. mongosh --host mongo1 <<EOF
  6.     config = {
  7.     _id: "rs0",
  8.     members: [
  9.         {
  10.         _id: 0,
  11.         host: "mongo1:27017",
  12.         },
  13.         {
  14.         _id: 1,
  15.         host: "mongo2:27017",
  16.         },
  17.         {
  18.         _id: 2,
  19.         host: "mongo3:27017",
  20.         },
  21.     ],
  22.     };
  23.     rs.initiate(config)
  24.     rs.status()
  25. EOF
  26.  
  27. echo "=============================================="
Advertisement
Add Comment
Please, Sign In to add comment