前言:这是文章<<单机搭建mongo集群,3个分片集>>配套配置文件
链接:https://editor.csdn.net/md?articleId=120353582
cd /data/mongo1/conf
mongo1 配置节点的配置文件
[root@node4 conf]# cat configsvr.conf systemLog: destination: file path: "/data/mongo1/logs/configsvr27100.log" logAppend: true storage: journal: enabled: true dbPath: "/data/mongo1/db_configsvr/" directoryPerDB: true wiredTiger: engineConfig: cacheSizeGB: 1 directoryForIndexes: true collectionConfig: blockCompressor: zlib indexConfig: prefixCompression: true net: bindIp: 127.0.0.1,192.168.199.204 port: 27100 replication: oplogSizeMB: 2048 replSetName: csvr sharding: clusterRole: configsvr processManagement: fork: true
mongo1 配置shard1的配置文件
[root@node4 conf]# cat shard1.conf systemLog: destination: file path: "/data/mongo1/logs/shard1_27017.log" logAppend: true storage: journal: enabled: true dbPath: "/data/mongo1/db_shard1" processManagement: fork: true net: bindIp: 127.0.0.1,192.168.199.204 port: 27017 setParameter: enableLocalhostAuthBypass: false replication: replSetName: "rs0" sharding: clusterRole: shardsvr
mongo1 配置shard2的配置文件
[root@node4 conf]# cat shard2.conf systemLog: destination: file path: "/data/mongo1/logs/shard2_27018.log" logAppend: true storage: journal: enabled: true dbPath: "/data/mongo1/db_shard2" processManagement: fork: true net: bindIp: 127.0.0.1,192.168.199.204 port: 27018 setParameter: enableLocalhostAuthBypass: false replication: replSetName: "rs1" sharding: clusterRole: shardsvr
mongo1 配置shard3的配置文件
[root@node4 conf]# cat shard3.conf systemLog: destination: file path: "/data/mongo1/logs/shard3_27019.log" logAppend: true storage: journal: enabled: true dbPath: "/data/mongo1/db_shard3" processManagement: fork: true net: bindIp: 127.0.0.1,192.168.199.204 port: 27019 setParameter: enableLocalhostAuthBypass: false replication: replSetName: "rs2" sharding: clusterRole: shardsvr
mongo1 配置路由节点配置文件
[root@node4 conf]# cat mongos.conf systemLog: destination: file path: "/data/mongo1/logs/mongos28100.log" logAppend: true net: bindIp: 127.0.0.1,192.168.199.204 port: 28100 # 将confige server 添加到路由 sharding: configDB: csvr/192.168.199.204:27100,192.168.199.204:27200,192.168.199.204:27300 processManagement: fork: true