Cluster

Matt Davis edited this page Apr 28, 2014 · 3 revisions

Setup MongoDB

Before a LuMongo cluster can be setup, a working MongoDB setup is needed. MongoDB can be sharded and replicated as needed in your environment. For more information on MongoDB please refer to the MongoDB documentation. MongoDB 2.6 is recommended but MongoDB 2.4 is supported.

Download LuMongo cluster

LuMongo cluster can be downloaded via the Releases page. After downloading, extract the contents into a directory, on each server that will make up the cluster.

Create a cluster

LuMongo cluster information is stored in a MongoDB database. Each mongo database can contains information about a single LuMongo cluster. To create a cluster first edit mongo.properties in the LuMongo directory on each cluster node. A sample mongo.properties file is shown below:

#Mongo config
   
#mongo database name
databaseName=lumongo

#mongo hostname
mongoHost=localhost
   
#mongo port number
mongoPort=27017

To create a cluster a cluster.properties file is also needed. Edit the cluster.properties file on the node you wish to create the cluster from. A sample cluster.properties is show below:

#Cluster Configuration

#set to true to enable sharding for mongo database and collection
sharded=false

#index block size for new index files (not recommended to change)
indexBlockSize=131072

#maximum number of blocks in memory allowed
#indexBlockSize*maxIndexBlock is approximately the max size used for index block cache
#There is also a index writer buffer for each segment so leave room for that
#Decreasing flushInterval for an index or commitInterval will help minimize
#this memory use per index segment at the cost of performance
#In the case of out of memory exceptions increase the JVM size, add more nodes,
#or decrease this size (at the cost of performance)
#Recommended Sizes:
#  with 128k blocks use 8000 for 2GB JVM Size
#  with 128k blocks use 20000 for 4GB JVM Size
#  with 128k blocks use 40000 for 8GB JVM Size
maxIndexBlocks=8000

#max connections from node to node
maxInternalClientConnections=16

#max workers for node to node connections
internalWorkers=16

#max workers for client to node connections
externalWorkers=16

#max wait for external connections to finish before shutting down
externalShutdownTimeout=10

#max wait for internal connections to finish before shutting down
internalShutdownTimeout=10

To create a cluster run the following command in the LuMongo directory:

bash clusteradmin.sh --command createCluster --mongoConfig mongo.properties --clusterConfig cluster.properties

Managing Nodes

Once the cluster is create nodes need to be registered. Before creating a node edit the node.properties file. A sample node.properties is shown below:

#Node config

#hazelcast port number
hazelcastPort=5701

#internal service port number
internalServicePort=32190

#external service port number
externalServicePort=32191

#rest port (comment out to disable)
restPort=32192

To register a node:

bash clusteradmin.sh --command registerNode --mongoConfig mongo.properties --nodeConfig node.properties

To register a node from a different server or to explicitly specific the address:

bash clusteradmin.sh --command registerNode --mongoConfig mongo.properties --nodeConfig node.properties
      --address 10.0.0.10

Multiple nodes can be registered on a single server for testing. These nodes are distinguished solely by hazelcast ports for management. However, all ports must be different to avoid port conflicts

To list current nodes:

bash clusteradmin.sh --command listNodes --mongoConfig mongo.properties

To remove local node:

bash clusteradmin.sh --command removeNode --mongoConfig mongo.properties

To remove a node from a different server with a different hazelcast port:

bash clusteradmin.sh --command removeNode --mongoConfig mongo.properties --address 10.0.0.10 --hazelcastPort 5702

Do not remove a LuMongo node that is currently started

#Starting Nodes

To start a node run:

bash startnode.sh --mongoConfig mongo.properties

To start a node and explicity specific local server address and hazelcast port:

bash startnode.sh --mongoConfig mongo.properties --address 10.0.0.10 --hazelcastPort 5702
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.