2026-03-12 21:01:38
This commit is contained in:
43
tiddlywiki/MongoDB - example replication.txt
Executable file
43
tiddlywiki/MongoDB - example replication.txt
Executable file
@@ -0,0 +1,43 @@
|
||||
-- create keyfile for communication between MongoDB instances
|
||||
openssl rand -base64 756 > /app/mongodb/conf/keyfile.basic
|
||||
chmod 600 /app/mongodb/conf/keyfile.basic
|
||||
|
||||
-- copy keyfile on ivera-mongo02 and ivera-mongo03
|
||||
|
||||
-- mongod.conf on ivera-mongo01
|
||||
-------------------------------
|
||||
storage:
|
||||
dbPath: "/data/mongodb/"
|
||||
journal:
|
||||
enabled: true
|
||||
wiredTiger:
|
||||
engineConfig:
|
||||
cacheSizeGB: 1
|
||||
|
||||
net:
|
||||
port: 27017
|
||||
bindIp: 127.0.0.1,ivera-mongo01,ivera-mongo01-priv
|
||||
|
||||
security:
|
||||
authorization: 'enabled'
|
||||
keyFile: /app/mongodb/conf/keyfile.basic
|
||||
|
||||
replication:
|
||||
replSetName: majrc
|
||||
oplogSizeMB: 100
|
||||
enableMajorityReadConcern: true
|
||||
|
||||
|
||||
-- similar config files on ivera-mongo02 and ivera-mongo03
|
||||
|
||||
|
||||
-- on ivera-mongo01 that will be defined as PRIMARY
|
||||
|
||||
cfg = { "_id" : "majrc", "members" : [ { "_id" : 0, "host":"ivera-mongo01-priv:27017", } ] }
|
||||
rs.initiate(cfg)
|
||||
|
||||
rs.add('ivera-mongo02-priv:27017');
|
||||
rs.add('ivera-mongo03-priv:27017');
|
||||
|
||||
rs.conf();
|
||||
rs.status();
|
||||
Reference in New Issue
Block a user