Mongo

Da GazziNet.
Vai alla navigazione Vai alla ricerca

wget https://downloads.mongodb.com/on-prem-mms/tar/mongodb-mms-4.0.2.50187.20180905T1454Z-1.x86_64.tar.gz
tar -xvzf mongodb-mms-4.0.2.50187.20180905T1454Z-1.x86_64.tar.gz
sudo mkdir -p /opt/mongodb/mms
sudo mv mongodb-mms-4.0.2.50187.20180905T1454Z-1.x86_64/* /opt/mongodb/mms/



wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.28.tgz
tar -xvzf mongodb-linux-x86_64-rhel70-4.0.28.tgz
sudo mv mongodb-linux-x86_64-rhel70-4.0.28 /opt/mongodb/mongo4


sudo mkdir -p /data/appdb/{rs0,rs1,rs2}
sudo mkdir -p /data/backupdb/{rs0,rs1,rs2}
sudo chown -R $(whoami) /data

compat-openssl11.x86_64


/opt/mongodb/mongo4/bin/mongod --replSet appdb --port 27017 --dbpath /data/appdb/rs0 --bind_ip localhost --fork --logpath /data/appdb/rs0/mongod.log
/opt/mongodb/mongo4/bin/mongod --replSet appdb --port 27018 --dbpath /data/appdb/rs1 --bind_ip localhost --fork --logpath /data/appdb/rs1/mongod.log
/opt/mongodb/mongo4/bin/mongod --replSet appdb --port 27019 --dbpath /data/appdb/rs2 --bind_ip localhost --fork --logpath /data/appdb/rs2/mongod.log



/opt/mongodb/mongo4/bin/mongo --port 27017 <<EOF
rs.initiate({
  _id: "appdb",
  members: [
    { _id: 0, host: "localhost:27017" },
    { _id: 1, host: "localhost:27018" },
    { _id: 2, host: "localhost:27019", arbiterOnly: true }
  ]
})
EOF


/opt/mongodb/mongo4/bin/mongod --replSet backupdb --port 27117 --dbpath /data/backupdb/rs0 --bind_ip localhost --fork --logpath /data/backupdb/rs0/mongod.log
/opt/mongodb/mongo4/bin/mongod --replSet backupdb --port 27118 --dbpath /data/backupdb/rs1 --bind_ip localhost --fork --logpath /data/backupdb/rs1/mongod.log
/opt/mongodb/mongo4/bin/mongod --replSet backupdb --port 27119 --dbpath /data/backupdb/rs2 --bind_ip localhost --fork --logpath /data/backupdb/rs2/mongod.log


/opt/mongodb/mongo4/bin/mongo --port 27117 <<EOF
rs.initiate({
  _id: "backupdb",
  members: [
    { _id: 0, host: "localhost:27117" },
    { _id: 1, host: "localhost:27118" },
    { _id: 2, host: "localhost:27119", arbiterOnly: true }
  ]
})
EOF


nano /opt/mongodb/mms/conf/conf-mms.properties


mongo.mongoUri=mongodb://localhost:27017,localhost:27018/?replicaSet=appdb
mms.backup.mongoUri=mongodb://localhost:27117,localhost:27118/?replicaSet=backupdb


cd /opt/mongodb/mms
./bin/mongodb-mms start


LEGEND
[BOX]   = target version/state
-->     = upgrade step (in-place / rolling)
===     = parallel tracks
*note   = important note

======================================================================
TRACKS:            |           OPS MANAGER           |   MONGODB
======================================================================

START              | [OM 4.0]                        | [MDB 4.0]
                   |    |                            |    |
STEP 1             |    +--> [OM 6.0] -------------- |    |   *OM first
                   |               \                 |    |
STEP 2 (DB)        |                 \                | [MDB 4.2]
                   |                  \--------------->    |
STEP 3 (DB)        |                                   [MDB 4.4]
                   |                                            *4.4 unlocks OM 8.0 path
STEP 4             |    +--------------------------------> [OM 8.0]
                   |                                       |
STEP 5 (DB)        |                                       +--> [MDB 5.0] (deprecated in OM 8.0, still works)
STEP 6 (DB)        |                                       +--> [MDB 6.0]
STEP 7 (DB)        |                                       +--> [MDB 7.0] or [MDB 8.0]

======================================================================
REPLICA SET (rolling upgrade sequence under OM 8.0)
======================================================================
Primary/Secondaries:
   [S1 4.x]   [P 4.x]   [S2 4.x]
       |         |         |
       +---- upgrade S1 ---->
       |         |         |
       +-------------- step-down P, upgrade P ------->
       |         |         |
       +----------------------- upgrade S2 ---------->
       |         |         |
       +---- bump FCV (featureCompatibilityVersion) ->

Repeat per each major jump: 4.4 -> 5.0 -> 6.0 -> 7.0/8.0

======================================================================
SHARDED CLUSTER (under OM 8.0)
======================================================================
Order:
  1) mongos routers
  2) config server replica set (CSRS)
  3) each shard (replica set) one by one (rolling)

Example (one shard shown):
   [mongos] --> upgrade all mongos
   [CSRS]  --> rolling upgrade
   [ShardA RS] --> rolling upgrade
   [ShardB RS] --> rolling upgrade
   ...
   After all: set FCV cluster-wide

======================================================================
AGENTS & BACKUP
======================================================================
Automation/Monitoring/Backup Agents:
  [Agent n-1] --> update to latest supported by [OM 8.0]

Ops Manager backing DBs (Application DB, Backup DB):
  Keep them on supported versions (4.4+ recommended). If old:
  [appdb RS 4.0/4.2] --> 4.4 --> 5.0/6.0 as needed (rolling)

======================================================================
CHECKPOINTS / POLICY
======================================================================
- Backup/snapshot before every major step
- Verify compatibility matrix (OM 8.0 supports MDB 4.4–8.0)
- Upgrade FCV only after binaries are upgraded on all nodes
- Staging test before production
- One cluster at a time; monitor replication lag & health