SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Downloaden Sie, um offline zu lesen
MongoDB Sharding Cluster Installation Guide
Version                   Author                                   Abstract                                                  Release date

0.1                       Philip zhong                             Draft                                                     2012-07-09




      Deployment Architecture ................................................................................................................... 2

      Prepare Servers ................................................................................................................................. 2
Deployment Architecture




        Prepare Servers

Shard Name   Primary Instance server   Second Instance server   Mongos Server         Config Server
Shard1       10.224.56.105:27017       null                     10.224.56.105:30000   10.224.57.165:20000
Shard2       10.224.56.106:27017       null                     10.224.56.106:30000   10.224.57.165:20000
Shard3       10.224.56.107:27017       null                     10.224.56.107:30000   10.224.57.165:20000
Shard4       10.224.56.108:27017       null                     10.224.56.108:30000   10.224.57.165:20000
Shard5       10.224.56.109:27017       null                     10.224.56.109:30000   10.224.57.165:20000
Shard6       10.224.56.110:27017       null                     10.224.56.110:30000   10.224.57.165:20000
Shard7       10.224.56.111:27017       null                     10.224.56.111:30000   10.224.57.165:20000
Shard8       10.224.56.112:27017       null                     10.224.56.112:30000   10.224.57.165:20000
Shard9       10.224.56.113:27017       null                     10.224.56.113:30000   10.224.57.165:20000
Shard10      10.224.56.114:27017       null                     10.224.56.114:30000   10.224.57.165:20000


        *Notice:

         1. You can install Mongos to another single server.
2. You can use three config servers to improve the High availability.

3. You can install three replica set to improve the High availability.

1. Install Primary/secondary Instance program on every shard
   instance server.
  Please refer to << MongoDB_Program_Installation_Guide.doc>>

  #su - root

  # mkdir -p /data/mongo

  # mkdir -p /var/log/mongo/

  # chown -R mongodb:mongodb            /data/mongo

  # chown -R mongodb:mongodb /var/log/mongo

  # mkdir -p      /data/mongo/shard1/

  #numactl --interleave=all /opt/mongodb206/bin/mongod --shardsvr --replSet shard1 --port
  27017 --dbpath /data/mongo/shard1 --oplogSize 100 --logpath /var/log/mongo/mongod.log --
  logappend --fork --journal



  * Notice:

  1. You can change it by you install directory.

  2. If you have secondary replica set, you can start primary replica set with nojournal

2. Initiate MongoDB replica set on every shard instance server.
  # /opt/mongodb206/bin/mongo

    >config = {_id: 'shard1' , members:

       [

              {_id: 0, host: '10.224.56.105:27017'}

       ]

      }

       >rs.initiate(config)
* Notice:

    1. If you want to add secondary replica set, you can add the server and port into Initiation.

3. Install config program on config server
   Please refer to << MongoDB_Program_Installation_Guide.doc>>

    #su - mongodb

    # mkdir -p /data/mongo/config

    # numactl --interleave=all /opt/mongodb206/bin/mongod --configsvr --dbpath
/data/mongo/config --port 20000 --logpath /data/mongo/config/config.log --logappend --fork

4. Install mongos program on every shard mongos server
   If mongos server and mongoDB instance are not in same server, please refer to <<
   MongoDB_Program_Installation_Guide.doc >>

   #su -root

   # mkdir -p /var/log/mongo/

   # chown -R mongodb:mongodb /var/log/mongo

   #su - mongodb

   #/opt/mongodb206/bin/mongos --configdb 10.224.57.165:20000 --port 30000 --chunkSize
   1000 --logpath /var/log/mongo/mongos.log --logappend –fork



5. Configure Shard Cluster
   Login one mongos server, For example:

   #/opt/mongodb206/bin/mongo 10.224.56.114:30000/admin

   >db.runCommand ({addshard:"shard1/10.224.56.105:27017",name:"s1",maxsize:20480});

   >db.runCommand({addshard:"shard2/10.224.56.106:27017",name:"s2",maxsize:20480});

   >db.runCommand({addshard:"shard3/10.224.56.107:27017",name:"s3",maxsize:20480});

   >db.runCommand({addshard:"shard4/10.224.56.108:27017",name:"s4",maxsize:20480});

   >db.runCommand({addshard:"shard5/10.224.56.109:27017",name:"s5",maxsize:20480});

   >db.runCommand({addshard:"shard6/10.224.56.110:27017",name:"s6",maxsize:20480});
>db.runCommand({addshard:"shard7/10.224.56.111:27017",name:"s7",maxsize:20480});

>db.runCommand({addshard:"shard8/10.224.56.112:27017",name:"s8",maxsize:20480});

>db.runCommand({addshard:"shard9/10.224.56.113:27017",name:"s9",maxsize:20480});

>db.runCommand({addshard:"shard10/10.224.56.114:27017",name:"s10",maxsize:20480});

>db.runCommand({listshards : 1 })

>db.runCommand( { enablesharding : "<dbname>" } );

>db.runCommand( { shardcollection : "<dbname.collection>" , key : { "keyname" : 1 } }



For example:

>db.runCommand({enablesharding :"feeddb"})

>db.runCommand( { shardcollection : "feeddb.test" , key : { "username" : 1 } } );

for (var x=97; x<97+26; x+=3){

      var y=(97+25);

      var prefix = String.fromCharCode(x) + String.fromCharCode(y);

      db.runCommand( { split :"feeddb.test", middle : {username : prefix } } );

  }
6. Trouble shooting
  #on testing ENV, you need turn off firewall and then you need restart the mongo programs.

  #/etc/init.d/iptables status

  #/etc/init.d/iptables stop

  #/etc/init.d/iptables status

  #chkconfig iptables off

7. Install Monitor program
  ???

Weitere ähnliche Inhalte

Was ist angesagt?

How to train your L3DSR with PBR - MEMO -
How to train your L3DSR with PBR - MEMO -How to train your L3DSR with PBR - MEMO -
How to train your L3DSR with PBR - MEMO -Naoto MATSUMOTO
 
Creación de máquinas virtuales basada en kernel usando qemu y virsh
Creación de máquinas virtuales basada en kernel usando qemu y virshCreación de máquinas virtuales basada en kernel usando qemu y virsh
Creación de máquinas virtuales basada en kernel usando qemu y virshJonathan Franchesco Torres Baca
 
Solaris 11 base box for Vagrant using Packer
Solaris 11 base box for Vagrant using PackerSolaris 11 base box for Vagrant using Packer
Solaris 11 base box for Vagrant using PackerAlan Chalmers
 
MAASとJujuでつくるOpenStack環境構築入門 IceHouse対応版 - OpenStack最新情報セミナー 2014年10月
MAASとJujuでつくるOpenStack環境構築入門 IceHouse対応版 - OpenStack最新情報セミナー 2014年10月MAASとJujuでつくるOpenStack環境構築入門 IceHouse対応版 - OpenStack最新情報セミナー 2014年10月
MAASとJujuでつくるOpenStack環境構築入門 IceHouse対応版 - OpenStack最新情報セミナー 2014年10月VirtualTech Japan Inc.
 
JavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureJavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureShiju Varghese
 
How to Install Ghost (CMS) MEMO
How to Install Ghost (CMS) MEMOHow to Install Ghost (CMS) MEMO
How to Install Ghost (CMS) MEMONaoto MATSUMOTO
 
Disk suit 4 setup and installation
Disk suit 4 setup and installationDisk suit 4 setup and installation
Disk suit 4 setup and installationppratish
 
How to ride a 100GbE LAN -MEMO-
How to ride a 100GbE LAN -MEMO-How to ride a 100GbE LAN -MEMO-
How to ride a 100GbE LAN -MEMO-Naoto MATSUMOTO
 
Openstack kilo installation using rdo
Openstack kilo installation using rdoOpenstack kilo installation using rdo
Openstack kilo installation using rdoNarasimha sreeram
 
Openstack installation using rdo
Openstack installation using rdoOpenstack installation using rdo
Openstack installation using rdoNarasimha sreeram
 
How to make a WoW server Warlords of Draenor
How to make a WoW server Warlords of DraenorHow to make a WoW server Warlords of Draenor
How to make a WoW server Warlords of DraenorMohit Maheshwari
 
How to make multi-boot USB drive for LiveCD iso images on EFI/UEFI and BIOS
 How to make multi-boot USB drive for LiveCD iso images on EFI/UEFI and BIOS How to make multi-boot USB drive for LiveCD iso images on EFI/UEFI and BIOS
How to make multi-boot USB drive for LiveCD iso images on EFI/UEFI and BIOSKentaro Hatori
 
Openstack installation using rdo multi node
Openstack installation using rdo multi nodeOpenstack installation using rdo multi node
Openstack installation using rdo multi nodeNarasimha sreeram
 
Mac osx snow leopard 10
Mac osx snow leopard 10Mac osx snow leopard 10
Mac osx snow leopard 10sketchout
 
Installing OpenStack Juno using RDO on RHEL
Installing OpenStack Juno using RDO on RHELInstalling OpenStack Juno using RDO on RHEL
Installing OpenStack Juno using RDO on RHELopenstackstl
 
Virtual box installation
Virtual box installationVirtual box installation
Virtual box installationNiranjan Pandey
 
A3 sec -_msr_2.0
A3 sec -_msr_2.0A3 sec -_msr_2.0
A3 sec -_msr_2.0a3sec
 

Was ist angesagt? (20)

How to train your L3DSR with PBR - MEMO -
How to train your L3DSR with PBR - MEMO -How to train your L3DSR with PBR - MEMO -
How to train your L3DSR with PBR - MEMO -
 
Creación de máquinas virtuales basada en kernel usando qemu y virsh
Creación de máquinas virtuales basada en kernel usando qemu y virshCreación de máquinas virtuales basada en kernel usando qemu y virsh
Creación de máquinas virtuales basada en kernel usando qemu y virsh
 
Solaris 11 base box for Vagrant using Packer
Solaris 11 base box for Vagrant using PackerSolaris 11 base box for Vagrant using Packer
Solaris 11 base box for Vagrant using Packer
 
MAASとJujuでつくるOpenStack環境構築入門 IceHouse対応版 - OpenStack最新情報セミナー 2014年10月
MAASとJujuでつくるOpenStack環境構築入門 IceHouse対応版 - OpenStack最新情報セミナー 2014年10月MAASとJujuでつくるOpenStack環境構築入門 IceHouse対応版 - OpenStack最新情報セミナー 2014年10月
MAASとJujuでつくるOpenStack環境構築入門 IceHouse対応版 - OpenStack最新情報セミナー 2014年10月
 
JavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureJavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows Azure
 
How to Install Ghost (CMS) MEMO
How to Install Ghost (CMS) MEMOHow to Install Ghost (CMS) MEMO
How to Install Ghost (CMS) MEMO
 
Disk suit 4 setup and installation
Disk suit 4 setup and installationDisk suit 4 setup and installation
Disk suit 4 setup and installation
 
How to ride a 100GbE LAN -MEMO-
How to ride a 100GbE LAN -MEMO-How to ride a 100GbE LAN -MEMO-
How to ride a 100GbE LAN -MEMO-
 
Openstack kilo installation using rdo
Openstack kilo installation using rdoOpenstack kilo installation using rdo
Openstack kilo installation using rdo
 
Dev ops
Dev opsDev ops
Dev ops
 
MongoDB 3.2.0 Released
MongoDB 3.2.0 ReleasedMongoDB 3.2.0 Released
MongoDB 3.2.0 Released
 
Openstack installation using rdo
Openstack installation using rdoOpenstack installation using rdo
Openstack installation using rdo
 
How to make a WoW server Warlords of Draenor
How to make a WoW server Warlords of DraenorHow to make a WoW server Warlords of Draenor
How to make a WoW server Warlords of Draenor
 
How to make multi-boot USB drive for LiveCD iso images on EFI/UEFI and BIOS
 How to make multi-boot USB drive for LiveCD iso images on EFI/UEFI and BIOS How to make multi-boot USB drive for LiveCD iso images on EFI/UEFI and BIOS
How to make multi-boot USB drive for LiveCD iso images on EFI/UEFI and BIOS
 
Fortinet SSL VPN access
Fortinet SSL VPN accessFortinet SSL VPN access
Fortinet SSL VPN access
 
Openstack installation using rdo multi node
Openstack installation using rdo multi nodeOpenstack installation using rdo multi node
Openstack installation using rdo multi node
 
Mac osx snow leopard 10
Mac osx snow leopard 10Mac osx snow leopard 10
Mac osx snow leopard 10
 
Installing OpenStack Juno using RDO on RHEL
Installing OpenStack Juno using RDO on RHELInstalling OpenStack Juno using RDO on RHEL
Installing OpenStack Juno using RDO on RHEL
 
Virtual box installation
Virtual box installationVirtual box installation
Virtual box installation
 
A3 sec -_msr_2.0
A3 sec -_msr_2.0A3 sec -_msr_2.0
A3 sec -_msr_2.0
 

Andere mochten auch

唯一一隻登上時代雜誌封面的狗狗
唯一一隻登上時代雜誌封面的狗狗唯一一隻登上時代雜誌封面的狗狗
唯一一隻登上時代雜誌封面的狗狗Fa Zhou Shi
 
Terugblik en resultatenoverzicht 2010
Terugblik en resultatenoverzicht 2010Terugblik en resultatenoverzicht 2010
Terugblik en resultatenoverzicht 2010Mieke Sanden, van der
 
Pm 02 track1-- 魏刚--osac-trusted-computing-pools-in-folsom-v2
Pm 02 track1-- 魏刚--osac-trusted-computing-pools-in-folsom-v2Pm 02 track1-- 魏刚--osac-trusted-computing-pools-in-folsom-v2
Pm 02 track1-- 魏刚--osac-trusted-computing-pools-in-folsom-v2OpenCity Community
 
Putting the WOW into your School's WOM, ADVIS Presentation
Putting the WOW into your School's WOM, ADVIS PresentationPutting the WOW into your School's WOM, ADVIS Presentation
Putting the WOW into your School's WOM, ADVIS PresentationRick Newberry
 
Am 04 track1--salvatore orlando--openstack-apac-2012-final
Am 04 track1--salvatore orlando--openstack-apac-2012-finalAm 04 track1--salvatore orlando--openstack-apac-2012-final
Am 04 track1--salvatore orlando--openstack-apac-2012-finalOpenCity Community
 
Hp cloud performance_benchmark
Hp cloud performance_benchmarkHp cloud performance_benchmark
Hp cloud performance_benchmarkOpenCity Community
 
Multiple Intelligences in the Classroom by Carol Levensaler, CSU, Chico
Multiple Intelligences in the Classroom by Carol Levensaler, CSU, ChicoMultiple Intelligences in the Classroom by Carol Levensaler, CSU, Chico
Multiple Intelligences in the Classroom by Carol Levensaler, CSU, ChicoTanya Madjarova
 
Wiggins & Poulton: Malawi Farm Input Supply Scheme
Wiggins & Poulton: Malawi Farm Input Supply SchemeWiggins & Poulton: Malawi Farm Input Supply Scheme
Wiggins & Poulton: Malawi Farm Input Supply Schemefutureagricultures
 
Eksamensbeviser fra RUC og Copenhagen Business School
Eksamensbeviser fra RUC og Copenhagen Business SchoolEksamensbeviser fra RUC og Copenhagen Business School
Eksamensbeviser fra RUC og Copenhagen Business SchoolJohnny Grenzlikowski
 
То, что вы хотели знать о HandlerSocket, но не смогли нагуглить
 То, что вы хотели знать о HandlerSocket, но не смогли нагуглить То, что вы хотели знать о HandlerSocket, но не смогли нагуглить
То, что вы хотели знать о HandlerSocket, но не смогли нагуглитьSergey Xek
 
Anti Hypertensives- pharmacology
Anti Hypertensives- pharmacologyAnti Hypertensives- pharmacology
Anti Hypertensives- pharmacologyBeenish Bhutta
 
Ливоблисс Надежная защита Вашей печени
Ливоблисс  Надежная защита Вашей печениЛивоблисс  Надежная защита Вашей печени
Ливоблисс Надежная защита Вашей печениЕлена Шальнова
 
Juveline Crime in Bulgaria
Juveline Crime in BulgariaJuveline Crime in Bulgaria
Juveline Crime in BulgariaTanya Madjarova
 

Andere mochten auch (20)

唯一一隻登上時代雜誌封面的狗狗
唯一一隻登上時代雜誌封面的狗狗唯一一隻登上時代雜誌封面的狗狗
唯一一隻登上時代雜誌封面的狗狗
 
Presentació del diccionari grec clàssic català
Presentació del diccionari grec clàssic catalàPresentació del diccionari grec clàssic català
Presentació del diccionari grec clàssic català
 
Grammar book
Grammar bookGrammar book
Grammar book
 
Terugblik en resultatenoverzicht 2010
Terugblik en resultatenoverzicht 2010Terugblik en resultatenoverzicht 2010
Terugblik en resultatenoverzicht 2010
 
Diseño de panalería, indumentaria 2012
Diseño de panalería, indumentaria 2012Diseño de panalería, indumentaria 2012
Diseño de panalería, indumentaria 2012
 
PNY Power Bank Series for Smart Devices
PNY Power Bank Series for Smart DevicesPNY Power Bank Series for Smart Devices
PNY Power Bank Series for Smart Devices
 
My MSc. Project
My MSc. ProjectMy MSc. Project
My MSc. Project
 
Pm 02 track1-- 魏刚--osac-trusted-computing-pools-in-folsom-v2
Pm 02 track1-- 魏刚--osac-trusted-computing-pools-in-folsom-v2Pm 02 track1-- 魏刚--osac-trusted-computing-pools-in-folsom-v2
Pm 02 track1-- 魏刚--osac-trusted-computing-pools-in-folsom-v2
 
Putting the WOW into your School's WOM, ADVIS Presentation
Putting the WOW into your School's WOM, ADVIS PresentationPutting the WOW into your School's WOM, ADVIS Presentation
Putting the WOW into your School's WOM, ADVIS Presentation
 
Am 04 track1--salvatore orlando--openstack-apac-2012-final
Am 04 track1--salvatore orlando--openstack-apac-2012-finalAm 04 track1--salvatore orlando--openstack-apac-2012-final
Am 04 track1--salvatore orlando--openstack-apac-2012-final
 
Hp cloud performance_benchmark
Hp cloud performance_benchmarkHp cloud performance_benchmark
Hp cloud performance_benchmark
 
Multiple Intelligences in the Classroom by Carol Levensaler, CSU, Chico
Multiple Intelligences in the Classroom by Carol Levensaler, CSU, ChicoMultiple Intelligences in the Classroom by Carol Levensaler, CSU, Chico
Multiple Intelligences in the Classroom by Carol Levensaler, CSU, Chico
 
Wiggins & Poulton: Malawi Farm Input Supply Scheme
Wiggins & Poulton: Malawi Farm Input Supply SchemeWiggins & Poulton: Malawi Farm Input Supply Scheme
Wiggins & Poulton: Malawi Farm Input Supply Scheme
 
Eksamensbeviser fra RUC og Copenhagen Business School
Eksamensbeviser fra RUC og Copenhagen Business SchoolEksamensbeviser fra RUC og Copenhagen Business School
Eksamensbeviser fra RUC og Copenhagen Business School
 
Assets models seminar
Assets models seminarAssets models seminar
Assets models seminar
 
То, что вы хотели знать о HandlerSocket, но не смогли нагуглить
 То, что вы хотели знать о HandlerSocket, но не смогли нагуглить То, что вы хотели знать о HandlerSocket, но не смогли нагуглить
То, что вы хотели знать о HandlerSocket, но не смогли нагуглить
 
Anti Hypertensives- pharmacology
Anti Hypertensives- pharmacologyAnti Hypertensives- pharmacology
Anti Hypertensives- pharmacology
 
Ливоблисс Надежная защита Вашей печени
Ливоблисс  Надежная защита Вашей печениЛивоблисс  Надежная защита Вашей печени
Ливоблисс Надежная защита Вашей печени
 
Juveline Crime in Bulgaria
Juveline Crime in BulgariaJuveline Crime in Bulgaria
Juveline Crime in Bulgaria
 
Biography
BiographyBiography
Biography
 

Ähnlich wie Mongo db sharding_cluster_installation_guide

Pandora FMS: MongoDB plugin
Pandora FMS: MongoDB pluginPandora FMS: MongoDB plugin
Pandora FMS: MongoDB pluginPandora FMS
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSudheer Kondla
 
Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica setSudheer Kondla
 
Percona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityPercona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityRam Gautam
 
How to Become Cloud Backup Provider
How to Become Cloud Backup ProviderHow to Become Cloud Backup Provider
How to Become Cloud Backup ProviderCloudian
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...Cloudian
 
Mongo db reference-manual
Mongo db reference-manualMongo db reference-manual
Mongo db reference-manualDan Llimpe
 
Mongo db reference manual
Mongo db reference manualMongo db reference manual
Mongo db reference manualDeysi Gmarra
 
Swift configurator installation-manual
Swift configurator installation-manualSwift configurator installation-manual
Swift configurator installation-manualPramod Sharma
 
How to become cloud backup provider
How to become cloud backup providerHow to become cloud backup provider
How to become cloud backup providerCLOUDIAN KK
 
MongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialMongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialJason Terpko
 
MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017Antonios Giannopoulos
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceBen Hall
 

Ähnlich wie Mongo db sharding_cluster_installation_guide (20)

Pandora FMS: MongoDB plugin
Pandora FMS: MongoDB pluginPandora FMS: MongoDB plugin
Pandora FMS: MongoDB plugin
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
 
Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica set
 
Percona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityPercona Cluster Installation with High Availability
Percona Cluster Installation with High Availability
 
How to Become Cloud Backup Provider
How to Become Cloud Backup ProviderHow to Become Cloud Backup Provider
How to Become Cloud Backup Provider
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
How to become cloud backup provider with Cloudian HyperStore and CloudBerry L...
 
Mongo db reference-manual
Mongo db reference-manualMongo db reference-manual
Mongo db reference-manual
 
Mongo db reference manual
Mongo db reference manualMongo db reference manual
Mongo db reference manual
 
MongoDB Shard Cluster
MongoDB Shard ClusterMongoDB Shard Cluster
MongoDB Shard Cluster
 
Swift configurator installation-manual
Swift configurator installation-manualSwift configurator installation-manual
Swift configurator installation-manual
 
How to become cloud backup provider
How to become cloud backup providerHow to become cloud backup provider
How to become cloud backup provider
 
Mdb dn 2016_09_34_features
Mdb dn 2016_09_34_featuresMdb dn 2016_09_34_features
Mdb dn 2016_09_34_features
 
Sharded cluster tutorial
Sharded cluster tutorialSharded cluster tutorial
Sharded cluster tutorial
 
MongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialMongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster Tutorial
 
MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017
 
MongoDB Replication Cluster
MongoDB Replication ClusterMongoDB Replication Cluster
MongoDB Replication Cluster
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 

Mehr von Philip Zhong

Cisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignCisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignPhilip Zhong
 
How to Implement Distributed Data Store
How to Implement Distributed Data Store How to Implement Distributed Data Store
How to Implement Distributed Data Store Philip Zhong
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge ShareingPhilip Zhong
 
Adapter Poxy Pattern
Adapter Poxy PatternAdapter Poxy Pattern
Adapter Poxy PatternPhilip Zhong
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_costPhilip Zhong
 
Vitess percona 2012
Vitess percona 2012Vitess percona 2012
Vitess percona 2012Philip Zhong
 
Distributed_Database_System
Distributed_Database_SystemDistributed_Database_System
Distributed_Database_SystemPhilip Zhong
 
Mysql performance tuning
Mysql performance tuningMysql performance tuning
Mysql performance tuningPhilip Zhong
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testingPhilip Zhong
 
How to write_language_compiler
How to write_language_compilerHow to write_language_compiler
How to write_language_compilerPhilip Zhong
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Philip Zhong
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socketPhilip Zhong
 
Mysql architecture&parameters
Mysql architecture&parametersMysql architecture&parameters
Mysql architecture&parametersPhilip Zhong
 

Mehr von Philip Zhong (13)

Cisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignCisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store Design
 
How to Implement Distributed Data Store
How to Implement Distributed Data Store How to Implement Distributed Data Store
How to Implement Distributed Data Store
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge Shareing
 
Adapter Poxy Pattern
Adapter Poxy PatternAdapter Poxy Pattern
Adapter Poxy Pattern
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_cost
 
Vitess percona 2012
Vitess percona 2012Vitess percona 2012
Vitess percona 2012
 
Distributed_Database_System
Distributed_Database_SystemDistributed_Database_System
Distributed_Database_System
 
Mysql performance tuning
Mysql performance tuningMysql performance tuning
Mysql performance tuning
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testing
 
How to write_language_compiler
How to write_language_compilerHow to write_language_compiler
How to write_language_compiler
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socket
 
Mysql architecture&parameters
Mysql architecture&parametersMysql architecture&parameters
Mysql architecture&parameters
 

Mongo db sharding_cluster_installation_guide

  • 1. MongoDB Sharding Cluster Installation Guide Version Author Abstract Release date 0.1 Philip zhong Draft 2012-07-09 Deployment Architecture ................................................................................................................... 2 Prepare Servers ................................................................................................................................. 2
  • 2. Deployment Architecture Prepare Servers Shard Name Primary Instance server Second Instance server Mongos Server Config Server Shard1 10.224.56.105:27017 null 10.224.56.105:30000 10.224.57.165:20000 Shard2 10.224.56.106:27017 null 10.224.56.106:30000 10.224.57.165:20000 Shard3 10.224.56.107:27017 null 10.224.56.107:30000 10.224.57.165:20000 Shard4 10.224.56.108:27017 null 10.224.56.108:30000 10.224.57.165:20000 Shard5 10.224.56.109:27017 null 10.224.56.109:30000 10.224.57.165:20000 Shard6 10.224.56.110:27017 null 10.224.56.110:30000 10.224.57.165:20000 Shard7 10.224.56.111:27017 null 10.224.56.111:30000 10.224.57.165:20000 Shard8 10.224.56.112:27017 null 10.224.56.112:30000 10.224.57.165:20000 Shard9 10.224.56.113:27017 null 10.224.56.113:30000 10.224.57.165:20000 Shard10 10.224.56.114:27017 null 10.224.56.114:30000 10.224.57.165:20000 *Notice: 1. You can install Mongos to another single server.
  • 3. 2. You can use three config servers to improve the High availability. 3. You can install three replica set to improve the High availability. 1. Install Primary/secondary Instance program on every shard instance server. Please refer to << MongoDB_Program_Installation_Guide.doc>> #su - root # mkdir -p /data/mongo # mkdir -p /var/log/mongo/ # chown -R mongodb:mongodb /data/mongo # chown -R mongodb:mongodb /var/log/mongo # mkdir -p /data/mongo/shard1/ #numactl --interleave=all /opt/mongodb206/bin/mongod --shardsvr --replSet shard1 --port 27017 --dbpath /data/mongo/shard1 --oplogSize 100 --logpath /var/log/mongo/mongod.log -- logappend --fork --journal * Notice: 1. You can change it by you install directory. 2. If you have secondary replica set, you can start primary replica set with nojournal 2. Initiate MongoDB replica set on every shard instance server. # /opt/mongodb206/bin/mongo >config = {_id: 'shard1' , members: [ {_id: 0, host: '10.224.56.105:27017'} ] } >rs.initiate(config)
  • 4. * Notice: 1. If you want to add secondary replica set, you can add the server and port into Initiation. 3. Install config program on config server Please refer to << MongoDB_Program_Installation_Guide.doc>> #su - mongodb # mkdir -p /data/mongo/config # numactl --interleave=all /opt/mongodb206/bin/mongod --configsvr --dbpath /data/mongo/config --port 20000 --logpath /data/mongo/config/config.log --logappend --fork 4. Install mongos program on every shard mongos server If mongos server and mongoDB instance are not in same server, please refer to << MongoDB_Program_Installation_Guide.doc >> #su -root # mkdir -p /var/log/mongo/ # chown -R mongodb:mongodb /var/log/mongo #su - mongodb #/opt/mongodb206/bin/mongos --configdb 10.224.57.165:20000 --port 30000 --chunkSize 1000 --logpath /var/log/mongo/mongos.log --logappend –fork 5. Configure Shard Cluster Login one mongos server, For example: #/opt/mongodb206/bin/mongo 10.224.56.114:30000/admin >db.runCommand ({addshard:"shard1/10.224.56.105:27017",name:"s1",maxsize:20480}); >db.runCommand({addshard:"shard2/10.224.56.106:27017",name:"s2",maxsize:20480}); >db.runCommand({addshard:"shard3/10.224.56.107:27017",name:"s3",maxsize:20480}); >db.runCommand({addshard:"shard4/10.224.56.108:27017",name:"s4",maxsize:20480}); >db.runCommand({addshard:"shard5/10.224.56.109:27017",name:"s5",maxsize:20480}); >db.runCommand({addshard:"shard6/10.224.56.110:27017",name:"s6",maxsize:20480});
  • 5. >db.runCommand({addshard:"shard7/10.224.56.111:27017",name:"s7",maxsize:20480}); >db.runCommand({addshard:"shard8/10.224.56.112:27017",name:"s8",maxsize:20480}); >db.runCommand({addshard:"shard9/10.224.56.113:27017",name:"s9",maxsize:20480}); >db.runCommand({addshard:"shard10/10.224.56.114:27017",name:"s10",maxsize:20480}); >db.runCommand({listshards : 1 }) >db.runCommand( { enablesharding : "<dbname>" } ); >db.runCommand( { shardcollection : "<dbname.collection>" , key : { "keyname" : 1 } } For example: >db.runCommand({enablesharding :"feeddb"}) >db.runCommand( { shardcollection : "feeddb.test" , key : { "username" : 1 } } ); for (var x=97; x<97+26; x+=3){ var y=(97+25); var prefix = String.fromCharCode(x) + String.fromCharCode(y); db.runCommand( { split :"feeddb.test", middle : {username : prefix } } ); }
  • 6. 6. Trouble shooting #on testing ENV, you need turn off firewall and then you need restart the mongo programs. #/etc/init.d/iptables status #/etc/init.d/iptables stop #/etc/init.d/iptables status #chkconfig iptables off 7. Install Monitor program ???