Skip to content

Commit 68c21d3

Browse files
An example MongoDB replica set on Ubuntu
1 parent e961e73 commit 68c21d3

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

ubuntu-mongodb-repl/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM ccoleman/ubuntu-mongodb
2+
MAINTAINER Clayton Coleman <[email protected]>
3+
4+
CMD ["/usr/bin/mongod", "--config", "/etc/mongodb.conf", "--replSet", "replica0"]

ubuntu-mongodb/Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Install a more up to date mongodb than what is included in the default ubuntu repositories.
2+
3+
FROM ubuntu
4+
MAINTAINER Clayton Coleman <[email protected]>
5+
6+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
7+
RUN echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | tee -a /etc/apt/sources.list.d/10gen.list
8+
RUN apt-get update
9+
RUN apt-get -y install apt-utils
10+
RUN apt-get -y install mongodb-10gen
11+
12+
RUN mkdir -p /var/lib/mongodb && \
13+
touch /var/lib/mongodb/.keep && \
14+
chown -R mongodb:mongodb /var/lib/mongodb
15+
16+
VOLUME ["/var/lib/mongodb"]
17+
USER mongodb
18+
19+
ADD mongodb.conf /etc/mongodb.conf
20+
21+
EXPOSE 27017
22+
CMD ["/usr/bin/mongod", "--config", "/etc/mongodb.conf"]

ubuntu-mongodb/mongodb.conf

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# mongodb.conf
2+
3+
# Where to store the data.
4+
5+
# Note: if you run mongodb as a non-root user (recommended) you may
6+
# need to create and set permissions for this directory manually,
7+
# e.g., if the parent directory isn't mutable by the mongodb user.
8+
dbpath=/var/lib/mongodb
9+
10+
#where to log
11+
#logpath=/var/log/mongodb/mongodb.log
12+
13+
#logappend=true
14+
15+
#port = 27017
16+
17+
# Disables write-ahead journaling
18+
# nojournal = true
19+
20+
# Enables periodic logging of CPU utilization and I/O wait
21+
#cpu = true
22+
23+
# Turn on/off security. Off is currently the default
24+
#noauth = true
25+
#auth = true
26+
27+
# Verbose logging output.
28+
#verbose = true
29+
30+
# Inspect all client data for validity on receipt (useful for
31+
# developing drivers)
32+
#objcheck = true
33+
34+
# Enable db quota management
35+
#quota = true
36+
37+
# Set oplogging level where n is
38+
# 0=off (default)
39+
# 1=W
40+
# 2=R
41+
# 3=both
42+
# 7=W+some reads
43+
#diaglog = 0
44+
45+
# Ignore query hints
46+
#nohints = true
47+
48+
# Disable the HTTP interface (Defaults to localhost:28017).
49+
nohttpinterface = true
50+
51+
# Turns off server-side scripting. This will result in greatly limited
52+
# functionality
53+
#noscripting = true
54+
55+
# Turns off table scans. Any query that would do a table scan fails.
56+
#notablescan = true
57+
58+
# Disable data file preallocation.
59+
#noprealloc = true
60+
61+
# Specify .ns file size for new databases.
62+
# nssize = <size>
63+
64+
# Accout token for Mongo monitoring server.
65+
#mms-token = <token>
66+
67+
# Server name for Mongo monitoring server.
68+
#mms-name = <server-name>
69+
70+
# Ping interval for Mongo monitoring server.
71+
#mms-interval = <seconds>
72+
73+
# Replication Options
74+
75+
# in master/slave replicated mongo databases, specify here whether
76+
# this is a slave or master
77+
#slave = true
78+
#source = master.example.com
79+
# Slave only: specify a single database to replicate
80+
#only = master.example.com
81+
# or
82+
#master = true
83+
#source = slave.example.com
84+
85+
# in replica set configuration, specify the name of the replica set
86+
# replSet = setname

0 commit comments

Comments
 (0)