blob: bf44925f07a542c1c1c88e13881e41a92d171ac8 [file] [log] [blame]
Filip Pytloun34f960c2015-10-06 16:28:32 +02001=======
2MongoDB
3=======
4
5MongoDB (from "humongous") is an open-source document database, and the leading NoSQL database. Written in C++.
6
7Available states
8================
9
10.. contents::
11 :local:
12
13``mongodb.server``
14--------------------
15
16Setup MongoDB server
17
18Available metadata
19==================
20
21.. contents::
22 :local:
23
24``metadata.mongodb.server.single``
25----------------------------------
26
27Single-node MongoDB setup
28
29``metadata.mongodb.server.cluster``
30-----------------------------------
31
32Clustered MongoDB setup
33
34Configuration parameters
35========================
36
37
38Example reclass
39===============
40
41Setup MongoDB with database for ceilometer.
42
43.. code-block:: yaml
44
45 classes:
46 - service.mongodb.server.cluster
47 parameters:
48 _param:
49 mongodb_server_replica_set: ceilometer
50 mongodb_ceilometer_password: cloudlab
51 mongodb_admin_password: cloudlab
52 mongodb_shared_key: xxx
53 mongodb:
54 server:
55 database:
56 ceilometer:
57 enabled: true
58 password: ${_param:mongodb_ceilometer_password}
59 users:
60 - name: ceilometer
61 password: ${_param:mongodb_ceilometer_password}
62
63Sample pillars
64==============
65
66Simple single server
67
68.. code-block:: yaml
69
70 mongodb:
71 server:
72 enabled: true
73 bind:
74 address: 0.0.0.0
75 port: 27017
76 admin:
77 username: admin
78 password: magicunicorn
79 database:
80 dbname:
81 enabled: true
82 encoding: 'utf8'
83 users:
84 - name: 'username'
85 password: 'password'
86
87Cluster of 3 nodes
88
89.. code-block:: yaml
90
91 mongodb:
92 server:
93 enabled: true
94 admin:
95 user: admin
96 password: magicunicorn
97 master: mongo01
98 members:
99 - host: 192.168.1.11
100 priority: 2
101 - host: 192.168.1.12
102 - host: 192.168.1.13
103 replica_set: default
104 shared_key: magicunicorn
105
106It's possible that first Salt run on master node won't pass correctly before
107all slave nodes are up and ready.
108Simply run salt again on master node to setup cluster, databases and users.
109
110To check cluster status, execute following:
111
112.. code-block:: bash
113
114 mongo 127.0.0.1:27017/admin -u admin -p magicunicorn --eval "rs.status()"
115
116Read more
117=========
118
119* http://docs.mongodb.org/manual/
120* http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
121* https://www.linode.com/docs/databases/mongodb/creating-a-mongodb-replication-set-on-ubuntu-12-04-precise