副本: 副本集集群基础配置
环境介绍
正式开始
1、安装MongoDB
$ wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.22.tgz
$ ansible -i inventory mongocluster -m copy -a 'src=/Users/jinxiaozhang/mongodb-linux-x86_64-rhel62-3.6.5.tgz dest=/usr/local/'
$ ansible -i inventory mongocluster -m shell -a 'tar zxvf /usr/local/mongodb-linux-x86_64-rhel62-3.6.5.tgz -C /usr/local/2、创建我们所需要的目录
$ ansible -i inventory mongocluster -m shell -a 'mkdir /usr/local/mongodb-linux-x86_64-rhel70-3.2.22/data'
$ ansible -i inventory mongocluster -m shell -a 'mkdir /usr/local/mongodb-linux-x86_64-rhel70-3.2.22/shard1'
$ ansible -i inventory mongocluster -m shell -a 'mkdir /usr/local/mongodb-linux-x86_64-rhel70-3.2.22/logs'
$ ansible -i inventory mongocluster -m shell -a 'mkdir /usr/local/mongodb-linux-x86_64-rhel70-3.2.22/config'
$ ansible -i inventory mongocluster -m shell -a 'mkdir /usr/local/mongodb-linux-x86_64-rhel70-3.2.22/key'3、创建配置文件
4、启动服务
5、初始化副本集群
6、向副本集群添加节点成员
7、查看副本集群状态
Last updated
Was this helpful?