I want to enable oplog on mongoDB and the recommended approach is to setup a standalone replica set. I tried following the instructions here...
https://docs.mongodb.com/manual/reference/configuration-options/#replication-options
...and added the following to /etc/mongod.conf
replication:
oplogSizeMB: 1024
replSetName: rs0
After restarting I tried initialising and checking the the status but see the following...
> rs.initiate()
{
"ok" : 0,
"errmsg" : "This node was not started with the replSet option",
"code" : 76,
"codeName" : "NoReplicationEnabled"
}
> rs.conf()
2017-08-11T18:08:51.336+0900 E QUERY [thread1] Error: Could not retrieve replica set config: {
"ok" : 0,
"errmsg" : "not running with --replSet",
"code" : 76,
"codeName" : "NoReplicationEnabled"
}
The error states run with the --repSet option, but if I try the following the error still appears
sudo /usr/bin/mongod --config /etc/mongod.conf --replSet rs0
Update The config is being passed in
2017-08-13T21:19:03.708+0900 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=63900M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-08-13T21:19:05.688+0900 I CONTROL [initandlisten]
2017-08-13T21:19:05.689+0900 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-08-13T21:19:05.689+0900 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2017-08-13T21:19:05.689+0900 I CONTROL [initandlisten]
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten]
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten] ** WARNING: You are running on a NUMA machine.
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten] ** We suggest launching mongod like this to avoid performance problems:
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten] ** numactl --interleave=all mongod [other options]
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten]
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten]
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2017-08-13T21:19:05.690+0900 I CONTROL [initandlisten]
2017-08-13T21:19:05.912+0900 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
2017-08-13T21:19:05.915+0900 I REPL [initandlisten] Did not find local voted for document at startup.
2017-08-13T21:19:05.915+0900 I REPL [initandlisten] Did not find local replica set configuration document at startup; NoMatchingDocument: Did not find replica set configuration document in local.system.replset
2017-08-13T21:19:05.916+0900 I NETWORK [thread1] waiting for connections on port 27117