blob: e5965528807be452ce417045e28be3463b9ccc44 [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
Petr Michalec34d75d92016-10-25 16:36:43 +020094 logging:
95 verbose: false
96 logLevel: 1
97 oplogLevel: 0
Filip Pytloun34f960c2015-10-06 16:28:32 +020098 admin:
99 user: admin
100 password: magicunicorn
101 master: mongo01
102 members:
103 - host: 192.168.1.11
104 priority: 2
105 - host: 192.168.1.12
106 - host: 192.168.1.13
107 replica_set: default
108 shared_key: magicunicorn
109
110It's possible that first Salt run on master node won't pass correctly before
111all slave nodes are up and ready.
112Simply run salt again on master node to setup cluster, databases and users.
113
114To check cluster status, execute following:
115
116.. code-block:: bash
117
118 mongo 127.0.0.1:27017/admin -u admin -p magicunicorn --eval "rs.status()"
119
120Read more
121=========
122
123* http://docs.mongodb.org/manual/
124* http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
125* https://www.linode.com/docs/databases/mongodb/creating-a-mongodb-replication-set-on-ubuntu-12-04-precise