ric2b / mongo

The Mongo Database
http://www.mongodb.org/
0 stars 0 forks source link

Cluster Setup #2

Open ric2b opened 7 years ago

ric2b commented 7 years ago
1 config server:
mongo/mongod --configsvr --replSet devcluster_cfg --dbpath ~/dbs/db_c1/ --port 27010
mongo/mongo --host localhost --port 27010
    rs.initiate(
        {
            _id: "devcluster_cfg",
            configsvr: true,
            members: [
                { _id: 0, host: "localhost:27010"}
            ]
        }   
    )

2 shards:
mongo/mongod --shardsvr --replSet devcluster_sh1 --dbpath ~/dbs/db_s1 --port 27000
mongo/mongo --host localhost --port 27000
    rs.initiate(
        {
            _id: "devcluster_sh1",
            members: [
                { _id: 0, host: "localhost:27000"}
            ]
        }   
    )

mongo/mongod --shardsvr --replSet devcluster_sh2 --dbpath ~/dbs/db_s2 --port 27001
mongo/mongo --host localhost --port 27001
    rs.initiate(
        {
            _id: "devcluster_sh2",
            members: [
                { _id: 0, host: "localhost:27001"}
            ]
        }   
    )

1 mongos server:
mongo/mongos --configdb devcluster_cfg/localhost:27010 --port 27020
mongo/mongo --host localhost --port 27020
    sh.addShard( "devcluster_sh1/localhost:27000")
    sh.addShard( "devcluster_sh2/localhost:27001")

http://petermcmillan.com/articles/importing-geojson-data-mongodb
http://stackoverflow.com/a/24209349
mongo/mongoimport --host localhost:27020 --db wells_US -c points --file "pocos-mapa-escala.geojson"

db.settings.save( { _id:"chunksize", value: <sizeInMB> } )
sh.enableSharding("wells_US")

use wells_US

#db.points.createIndex({_id:"hashed"})
db.points.createIndex({"geometry.coordinates": "2dsphere"})
db.points.getIndexes()
#sh.shardCollection("wells_US.points", {_id: "hashed"})
sh.shardCollection("wells_US.points", {"geometry.coordinates": "2dsphere"})

http://stackoverflow.com/questions/4612835/how-to-verify-sharding
ric2b commented 7 years ago

This configuration: https://docs.mongodb.com/v3.2/core/sharded-cluster-components/#development-configuration

ric2b commented 7 years ago

These instructions: https://docs.mongodb.com/manual/tutorial/deploy-shard-cluster/

ric2b commented 7 years ago

https://docs.mongodb.com/manual/tutorial/modify-chunk-size-in-sharded-cluster/

ric2b commented 7 years ago

Order doesn't matter, but if you wanted to reduce the number of errors in the logs, you should shutdown mongos first, then shards, then config servers.

If there are no mongos processes still running, the three processes are unrelated and not talking to one another and may be shut down in any order. If there are still mongos processes active, shutting down the config server instance first should prevent any shard metadata changes while the other servers go down.

ric2b commented 7 years ago

https://gist.github.com/ric2b/0e06e470cdaa355dc00a01b38adfd6aa

ric2b commented 7 years ago

sh.stopBalancer()

ric2b commented 7 years ago

b /home/ricardo/mongo/src/mongo/s/chunk_manager.cpp:673 run --configdb devcluster_cfg/localhost:27010 --port 27020

ric2b commented 7 years ago

sh.splitAt("wells_US.points", {_id: "555555555555555555555555"}); sh.status()

ric2b commented 7 years ago

If you want to use a different compiler than the system compiler, you can override the C/C++ compilers on the command line like this: $ scons CC=/path/to/clang CXX=/path/to/clang++