I’ve been trying for two weeks to do the deploy to replica set task, but there’s no way. When it doesn’t find the node, the path doesn’t exist. Now it doesn’t replicate because the replicaSet is not there but I don’t know when to insert it.
mkdir -p /var/mongodb/pki/
openssl rand -base64 741 > /var/mongodb/pki/m103-keyfile
chmod 400 /var/mongodb/pki/m103-keyfile
user@M103# mkdir -p /var/mongodb/db/mongod_1
user@M103# mongod -f mongod_1.conf
user@M103# cp mongod_1.conf mongod_2.conf
user@M103# vi mongod_2.conf
user@M103# cp mongod_1.conf mongo_3.conf
user@M103# vi mongod_3.conf
user@M103# mongod -f mongod_2.conf
about to fork child process, waiting until server is ready for connections.
forked process: 381
child process started successfully, parent exitinguser@M103# mongod -f mongod_3.conf
about to fork child process, waiting until server is ready for connections.
forked process: 417
child process started successfully, parent exiting
user@M103# mongo --port 27001
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27001/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("b53dd372-069e-4b62-9018-704c27ddbdec") }
MongoDB server version: 4.0.5
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
> rs.initiate()
{
"ok" : 0,
"errmsg" : "This node was not started with the replSet option",
"code" : 76,
"codeName" : "NoReplicationEnabled"
}
> exit
when I do a:
vi mongod_1.conf
storage:
dbPath: /var/mongodb/db/1
net:
bindIp: localhost
port: 27001
security:
keyFile: /var/mongodb/pki/m103-keyfile
destination: file
path: /var/mongodb/logs/mongod1.log
logAppend: true
processManagement:
fork: true
replication:
replSetName: m103-repl
- mongod_1.conf 15/15 100%
Please, if somebody can help me to do the task I would be grateful for.