Sign inSign up

tossp/mongo

By tossp

•Updated almost 9 years ago

Image
0

268

tossp/mongo repository overview

⁠What is MongoDB?

MongoDB (from "humongous") is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster. Released under a combination of the GNU Affero General Public License and the Apache License, MongoDB is free and open-source software.

wikipedia.org/wiki/MongoDB⁠

logo


⁠How To Use

⁠docker engine

docker run -d -p 27017:27017 -e DB_NAME=mongo khezen/mongo:latest   

⁠docker-compose

version: '2'
services:
    mongod1:
        image: khezen/mongo:3.4
        environment:
            RS_NAME: rs
            STORAGE_ENGINE: rocksdb
        volumes:
             - /data/mongo/mongod1:/data/db
        ports:
             - "27017:27017"
        network_mode: bridge
        restart: always


⁠Environment Variables

⁠General

⁠STORAGE_ENGINE | wiredTiger

Choose the storage engine to be used:

⁠AUTH | n

To enable AUTHentication, set to y.

⁠ADMIN_USER | admin

User with root permissions on the admin DB_NAME. (AUTH has to be set to y).

⁠ADMIN_PWD | changeme

The password of the ADMIN_USER above. (AUTH has to be set to y).

⁠DB_NAME | (empty by default)

Create a new DB_NAME with this name.

⁠DB_USER | user

User with owner permissions on the DB_NAME above. (AUTH has to be set to y, DB_NAME has to be specified).

⁠DB_PWD | changeme

The password of the DB_USER above. (AUTH has to be set to y, DB_NAME has to be specified).

⁠DATA_PATH | /data/db

The path to data storing floder.

⁠OPLOG_SIZE | 50

Define the size of Oplog⁠, in megabytes.

⁠Replica Set

⁠RS_NAME | (empty by default)

Define the name of the replica set on which you want this server to be attached.

⁠MASTER | $HOSTNAME

Define the host:port of the master during replica set init. (RS_NAME has to be specified).

⁠SLAVES | (empty by default)

Define the host:port members you want to add to a replica set from its master. (RS_NAME has to be specified, MASTER has to be specified).

See examples⁠

⁠ARBITRERS | (empty by default)

Define the host:port arbitrers you want to add to a replica set from its master. (RS_NAME has to be specified, MASTER has to be specified, SLAVES has to be specified).

See examples⁠

⁠SLAVE_OK | y

y means you can read from slaves.

⁠Sharded Cluster

⁠SHARD_SVR | n

y means mongod is a shard by adding --shardsvr option.

⁠CONFIG_SVR | n

y means mongod is launched as a config server by adding --configsvr option.

⁠CONFIG_SERVERS | (empty by default)

Start a mongos instance instead of a mongod and define the rsname/host:port config servers attached to it.

⁠SHARDS | (empty by default)

Define the rsname/host:port shards you want to add to a cluster.(CONFIG_SERVERS has to be specified).

NOTE: if DB_NAME is specified, then sharding is automatically enabled for the database named after it.

See examples⁠

⁠User Feedback

⁠Issues

If you have any problems with or questions about this image, please ask for help through a GitHub issue⁠.

Tag summary

Content type

Image

Digest

Size

87.4 MB

Last updated

almost 9 years ago

docker pull tossp/mongo