1. 加入host /etc/hosts

  2. 關閉防火牆

  3. 確認時區

  4. 調整 CentOS 設定 ulimit

yum install

  1. 將要使用的mongodb的版本號以及gpg key的資料加進 /etc/yum.repos.d,
  2. yum install mongodb-org -y

keyfile

但conf內尚未設定:

#security:
#keyFile: /var/lib/mongodb-keyfile
#clusterAuthMode: sendKeyFile

在replica set啟用以及mongo user設定好後才用sed -i啟用security

Config server

  1. mongos --configdb myserver:40001,myserver:40002,myserver:40003 或是寫在 conf 檔案內
  2. 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

results matching ""

    No results matching ""