Created
July 9, 2014 12:18
-
-
Save yauh/7f65a5c8d95a91e4a0ad to your computer and use it in GitHub Desktop.
Ansible install mongo cluster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: mongodb | |
sudo: True | |
remote_user: droid | |
roles: | |
- role: mongo_mongod | |
mongod_datadir_prefix: "/data" | |
mongod_replication: true | |
mongod_port: 2701 | |
mongod_repl_servers: ['mongo1', 'mongo2', 'mongo3' ] | |
mongod_repl_master: mongo1 | |
mongod_replset_name: rs1 | |
- role: mongo_mongoc | |
mongoc_datadir_prefix: "/data" | |
mongoc_port: 2800 | |
mongoc_admin_pass: password | |
- role: mongo_mongos | |
mongos_keyfile_dir_prefix: "/data" | |
mongos_port: 2900 | |
mongoc_port: 2800 | |
mongoc_servers: ['mongo1', 'mongo2', 'mongo3'] | |
mongos_chunk_size: 1 | |
- role: mongo_shard | |
mongo_shard_list: | |
- replset_name: rs1 | |
hostname: mongo1 | |
port: 2701 | |
- replset_name: rs2 | |
hostname: mongo2 | |
port: 2701 | |
- replset_name: rs3 | |
hostname: mongo3 | |
port: 2701 | |
mongos_port: 2900 | |
mongoc_admin_pass: password | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
root@mongo1:/home/stephan# /usr/bin/mongo --port 2701 /tmp/repset_init.js
MongoDB shell version: 2.4.10
connecting to: 127.0.0.1:2701/test
{
"set" : "rs1",
"date" : ISODate("2014-07-09T13:18:45Z"),
"myState" : 4,
"members" : [
{
"_id" : 0,
"name" : "mongo1:2701",
"health" : 1,
"state" : 4,
"stateStr" : "FATAL",
"uptime" : 4099,
"optime" : Timestamp(1404719847, 1),
"optimeDate" : ISODate("2014-07-07T07:57:27Z"),
"self" : true
},
{
"_id" : 1,
"name" : "mongo2:2701",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 4094,
"optime" : Timestamp(1404717875, 1),
"optimeDate" : ISODate("2014-07-07T07:24:35Z"),
"lastHeartbeat" : ISODate("2014-07-09T13:18:45Z"),
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
"pingMs" : 0
}
],
"ok" : 1
}