加入host /etc/hosts
關閉防火牆
確認時區
調整 CentOS 設定
ulimit
yum install
- 將要使用的mongodb的版本號以及gpg key的資料加進 /etc/yum.repos.d,
yum install mongodb-org -y
keyfile
但conf內尚未設定:
#security:
#keyFile: /var/lib/mongodb-keyfile
#clusterAuthMode: sendKeyFile
在replica set啟用以及mongo user設定好後才用sed -i
啟用security
Config server
mongos --configdb myserver:40001,myserver:40002,myserver:40003
或是寫在 conf 檔案內- cluster內server的名字(ex: myserver)必須要routable and visible; 可以再domain name server內設定接口, 以確保成員可以互相看見, 有real ip, 而不只是127.0.0.1, because they need to be routed from other machine.
UP-RUNNING
mongod -f /etc/mongo-configserv.conf
mongos -f /etc/mongo-routingserv.conf
進入route server內
- 新增users
- 建立sharding