{"id":227395,"date":"2014-06-24T14:06:03","date_gmt":"2014-06-24T10:06:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=227395"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=227395","title":{"rendered":"<span class=\"post_title\">MongoDB Sharded Cluster \u043d\u0430 Centos 6.5<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e MongoDB, \u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u043c\u043e\u043d\u0433\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<\/p>\n<p>  \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 MongoDB \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <b>\u0428\u0430\u0440\u0434<\/b><br \/>  \u0428\u0430\u0440\u0434 \u2014 \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441 mongod, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438. \u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 production, \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0440\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0440\u0435\u043f\u043b\u0438\u043a (replicaSet).<\/p>\n<p>  <b>\u0421\u0435\u0440\u0432\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439<\/b><br \/>  \u0422\u0430\u043a \u0436\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 mongod, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. \u041c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u0448\u0430\u0440\u0434\u0435.<\/p>\n<p>  <b>\u0421\u0435\u0440\u0432\u0435\u0440 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438<\/b><br \/>  \u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 mongos. \u0415\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043a \u0448\u0430\u0440\u0434\u0430\u043c.<br \/>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 MongoDB<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/e03\/31f\/205\/e0331f205133e7dd5a7e79fb9f660fe3.png\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0423\u0434\u043e\u0431\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0440\u043e\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<ul>\n<li> \u0421\u0435\u0440\u0432\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 + \u0441\u0435\u0440\u0432\u0435\u0440 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438<\/li>\n<li> \u0428\u0430\u0440\u0434<\/li>\n<\/ul>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0440\u043e\u043b\u0435\u0439 \u043c\u044b \u0438\u043c\u0435\u0435\u043c 3 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:  <\/p>\n<ul>\n<li>mongos01<\/li>\n<li>mongos02<\/li>\n<li>mongos03<\/li>\n<\/ul>\n<h5>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439<\/h5>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b mongod \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439, \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c<i> \/etc\/mongod.conf<\/i> \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u0438\u0434\u0443:  <\/p>\n<pre><code class=\"bash\">logpath=\/var\/log\/mongodb\/mongod.log logappend=true fork=true dbpath=\/opt\/mongocfg pidfilepath=\/var\/run\/mongodb\/mongod.pid bind_ip=&lt;lo ip&gt;,&lt;eth ip&gt; configsvr=false <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441  <\/p>\n<blockquote><p># service mongod start  <\/p><\/blockquote>\n<h5>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438<\/h5>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043f\u0430\u043a\u0435\u0442 mongodb-org-mongos  <\/p>\n<blockquote><p># rpm -qa | grep mongos<br \/>  mongodb-org-mongos-2.6.2-1.x86_64  <\/p><\/blockquote>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 mongos <i>\/etc\/mongos.conf<\/i> \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0435\u0433\u043e \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u0438\u0434\u0443:  <\/p>\n<pre><code class=\"bash\">configdb=mongos01:27019,mongos02:27019,mongos03:27019 # Mongo config servers addresses port = 27017 logpath = \/var\/log\/mongodb\/mongos.log logappend = true fork = true bind_ip=&lt;lo ip&gt;,&lt;eth ip&gt; verbose = false <\/code><\/pre>\n<p>  Mongo \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0432 \u0441\u0432\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 init script \u0434\u043b\u044f mongos, \u043f\u043e\u0441\u0435\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0433\u043e<\/p>\n<pre><code class=\"bash\">cat &gt; \/etc\/init.d\/mongos &lt;&lt; TheEnd  #!\/bin\/bash  # mongos - Startup script for mongos  # chkconfig: 35 85 15 # description: Mongo Router Process for sharding # processname: mongos # config: \/etc\/mongos.conf # pidfile: \/var\/run\/mongos.pid  . \/etc\/rc.d\/init.d\/functions  # mongos will read mongos.conf for configuration settings  # Add variable to support multiple instances of mongos # The instance name is by default the name of this init script # In this way another instance can be created by just copying this init script # and creating a config file with the same name and a .conf extension # For Example: #   \/etc\/init.d\/mongos2 #   \/etc\/mongos2.conf # Optionally also create a sysconfig file to override env variables below #   \/etc\/sysconfig\/mongos2 INSTANCE=`basename $0`  # By default OPTIONS just points to the \/etc\/mongod.conf config file # This can be overriden in \/etc\/sysconfig\/mongod OPTIONS=&quot; -f \/etc\/${INSTANCE}.conf&quot;  PID_PATH=\/var\/run\/mongo PID_FILE=${PID_PATH}\/${INSTANCE}.pid MONGO_BIN=\/usr\/bin\/mongos MONGO_USER=mongod MONGO_GROUP=mongod MONGO_ULIMIT=12000 MONGO_LOCK_FILE=\/var\/lock\/subsys\/${INSTANCE}  # Source sysconfig options so that above values can be overriden SYSCONFIG=&quot;\/etc\/sysconfig\/${INSTANCE}&quot; if [ -f &quot;$SYSCONFIG&quot; ]; then   . &quot;$SYSCONFIG&quot; || true fi  # Create mongo pids path if it does not exist if [ ! -d &quot;${PID_PATH}&quot; ]; then   mkdir -p &quot;${PID_PATH}&quot;   chown &quot;${MONGO_USER}:${MONGO_GROUP}&quot; &quot;${PID_PATH}&quot; fi  start() {   echo -n $&quot;Starting ${INSTANCE}: &quot;   daemon --user &quot;$MONGO_USER&quot; --pidfile $PID_FILE $MONGO_BIN $OPTIONS --pidfilepath=$PID_FILE   RETVAL=$?   echo   [ $RETVAL -eq 0 ] && touch $MONGO_LOCK_FILE   return $RETVAL }  stop() {   echo -n $&quot;Stopping ${INSTANCE}: &quot;   killproc -p $PID_FILE -t30 -TERM $MONGO_BIN   RETVAL=$?   echo   [ $RETVAL -eq 0 ] && rm -f $MONGO_LOCK_FILE   [ $RETVAL -eq 0 ] && rm -f $PID_FILE   return $RETVAL }  restart () {         stop         start }  ulimit -n $MONGO_ULIMIT RETVAL=0  case &quot;$1&quot; in   start)     start     ;;   stop)     stop     ;;   restart|reload|force-reload)     restart     ;;   condrestart)     [ -f $MONGO_LOCK_FILE ] && restart || :     ;;   status)     status -p $PID_FILE $MONGO_BIN     RETVAL=$?     ;;   *)     echo &quot;Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}&quot;     RETVAL=1 esac  exit $RETVAL TheEnd <\/code><\/pre>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c  <\/p>\n<blockquote><p>chmod +x \/etc\/init.d\/mongos<\/p><\/blockquote>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c<br \/>  service mongos start<\/p>\n<p>  \u0418 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c  <\/p>\n<pre><code class=\"bash\"># chkconfig mongod on # chkconfig mongos on <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445.<\/p>\n<h5>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0448\u0430\u0440\u0434\u043e\u0432<\/h5>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0448\u0430\u0440\u0434\u043e\u0432 \u0434\u043b\u044f production \u0441\u0440\u0435\u0434\u044b \u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0440\u0434 \u044d\u0442\u043e replica set.<br \/>  \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0432 MongoDB \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u0432 <a href=\"http:\/\/docs.mongodb.org\/manual\/core\/replication-introduction\/\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a><br \/>  \u041c\u044b \u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u0430 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u0441\u0440\u043e\u0439\u043a\u0435.<\/p>\n<p>  \u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 4 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:  <\/p>\n<ul>\n<li>Master \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0440\u0434\u0430 (mongo01-rs01)<\/li>\n<li>Slave \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0440\u0434\u0430 (mongo02-rs01)<\/li>\n<li>Master \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0448\u0430\u0440\u0434\u0430 (mongo01-rs02)<\/li>\n<li>Slave \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0448\u0430\u0440\u0434\u0430 (mongo02-rs02)<\/li>\n<\/ul>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043d\u0430 \u0432\u0441\u0435\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d mongodb<br \/>  \u0412 <i>\/etc\/mongodb.conf<\/i> \u043d\u0430 mongo01-rs01 \u0438 mongo02-rs01 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0438\u043c\u044f \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0448\u0430\u0440\u0434  <\/p>\n<pre><code class=\"bash\">replSet=rs01 <\/code><\/pre>\n<p>  \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c mongod.<br \/>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c mongo \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c Master  <\/p>\n<blockquote><p># mongo<\/p><\/blockquote>\n<p>  \u0418 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a  <\/p>\n<blockquote><p>&gt; rs.initiate()<\/p><\/blockquote>\n<p>  \u0427\u0442\u043e \u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433  <\/p>\n<blockquote><p>rs01:PRIMARY&gt; rs.conf()<\/p><\/blockquote>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435:  <\/p>\n<pre><code class=\"bash\">{         &quot;_id&quot; : &quot;rs01&quot;,         &quot;version&quot; : 7,         &quot;members&quot; : [                 {                         &quot;_id&quot; : 0,                         &quot;host&quot; : &quot;mongo01-rs01:27017&quot;                 }         ] } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430\u0448 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440  <\/p>\n<blockquote><p>rs01:PRIMARY&gt; rs.add(\u00abmongo02-rs01\u00bb)<\/p><\/blockquote>\n<p>  \u0418 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433  <\/p>\n<blockquote><p>rs01:PRIMARY&gt; rs.conf()<\/p><\/blockquote>\n<p>  <\/p>\n<pre><code class=\"bash\">{         &quot;_id&quot; : &quot;rs01&quot;,         &quot;version&quot; : 7,         &quot;members&quot; : [                 {                         &quot;_id&quot; : 0,                         &quot;host&quot; : &quot;mongo01-rs01:27017&quot;                 },                 {                         &quot;_id&quot; : 1,                         &quot;host&quot; : &quot;mongo02-rs01:27017&quot;,                 }         ] } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 MongoDB \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u0448\u0438\u043d \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0447\u0435\u0442\u043d\u044b\u043c.<br \/>  \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043a\u043e\u043f\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c <i>\u0410\u0440\u0431\u0438\u0442\u0440\u0430<\/i><\/p>\n<p>  <b>\u0410\u0440\u0431\u0438\u0442\u0440<\/b> \u2014 \u044d\u0442\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 mongod, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u043b\u0435\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a, \u043d\u043e \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0432\u044b\u0431\u043e\u0440\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0442\u0435\u0440\u0430.<br \/>  \u041f\u0440\u043e \u0442\u043e \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0432\u044b\u0431\u043e\u0440\u044b, \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 <a href=\"http:\/\/docs.mongodb.org\/manual\/core\/replica-set-elections\/#replica-set-elections\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a><br \/>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u043e\u0434 \u043d\u0435\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u2014 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u2014 mongos01<br \/>  \u041a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c, \u0442\u0430\u043c \u043f\u043e <i>service mongod start<\/i> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 mongod \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439.<br \/>  \u0427\u0442\u043e \u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0430\u0440\u0431\u0438\u0442\u0440\u0430 \u0440\u0443\u043a\u0430\u043c\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0433\u043e init script  <\/p>\n<pre><code class=\"bash\">cat &gt; \/etc\/init.d\/mongo-rs01-arb &lt;&lt; TheEnd #!\/bin\/bash  # mongod - Startup script for mongod  # chkconfig: 35 85 15 # description: Mongo is a scalable, document-oriented database. # processname: mongod # config: \/etc\/mongod.conf # pidfile: \/var\/run\/mongodb\/mongod.pid  . \/etc\/rc.d\/init.d\/functions  # things from mongod.conf get there by mongod reading it   # NOTE: if you change any OPTIONS here, you get what you pay for: # this script assumes all options are in the config file. CONFIGFILE=&quot;\/etc\/mongod-rs01-arb.conf&quot; OPTIONS=&quot; -f $CONFIGFILE&quot; SYSCONFIG=&quot;\/etc\/sysconfig\/mongod-rs01-arb&quot;  # FIXME: 1.9.x has a --shutdown flag that parses the config file and # shuts down the correct running pid, but that's unavailable in 1.8 # for now.  This can go away when this script stops supporting 1.8. DBPATH=`awk -F= '\/^dbpath[[:blank:]]*=[[:blank:]]*\/{print $2}' &quot;$CONFIGFILE&quot;` PIDFILE=`awk -F= '\/^pidfilepath[[:blank:]]*=[[:blank:]]*\/{print $2}' &quot;$CONFIGFILE&quot;` mongod=${MONGOD-\/usr\/bin\/mongod}  MONGO_USER=mongod MONGO_GROUP=mongod  if [ -f &quot;$SYSCONFIG&quot; ]; then     . &quot;$SYSCONFIG&quot; fi  # Handle NUMA access to CPUs (SERVER-3574) # This verifies the existence of numactl as well as testing that the command works NUMACTL_ARGS=&quot;--interleave=all&quot; if which numactl &gt;\/dev\/null 2&gt;\/dev\/null && numactl $NUMACTL_ARGS ls \/ &gt;\/dev\/null 2&gt;\/dev\/null then     NUMACTL=&quot;numactl $NUMACTL_ARGS&quot; else     NUMACTL=&quot;&quot; fi  start() {   # Recommended ulimit values for mongod or mongos   # See http:\/\/docs.mongodb.org\/manual\/reference\/ulimit\/#recommended-settings   #   ulimit -f unlimited   ulimit -t unlimited   ulimit -v unlimited   ulimit -n 64000   ulimit -m unlimited   ulimit -u 32000    echo -n $&quot;Starting mongod: &quot;   daemon --user &quot;$MONGO_USER&quot; &quot;$NUMACTL $mongod $OPTIONS &gt;\/dev\/null 2&gt;&1&quot;   RETVAL=$?   echo   [ $RETVAL -eq 0 ] && touch \/var\/lock\/subsys\/mongod-rs01-arb }  stop() {   echo -n $&quot;Stopping mongod: &quot;   killproc -p &quot;$PIDFILE&quot; -d 300 \/usr\/bin\/mongod   RETVAL=$?   echo   [ $RETVAL -eq 0 ] && rm -f \/var\/lock\/subsys\/mongod-rs01-arb }  restart () {     stop     start }   RETVAL=0  case &quot;$1&quot; in   start)     start     ;;   stop)     stop     ;;   restart|reload|force-reload)     restart     ;;   condrestart)     [ -f \/var\/lock\/subsys\/mongod ] && restart || :     ;;   status)     status $mongod     RETVAL=$?     ;;   *)     echo &quot;Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}&quot;     RETVAL=1 esac  exit $RETVAL TheEnd <\/code><\/pre>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c  <\/p>\n<blockquote><p># chmod+x \/etc\/init.d\/mongo-rs01-arb<\/p><\/blockquote>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043b\u044f \u043d\u0435\u0433\u043e BaseDir \u0438 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438  <\/p>\n<blockquote><p># mkdir \/opt\/mongo-rs01-arb; chown mongod:mongod \/opt\/mongo-rs01-arb<br \/>  # cp -av \/etc\/mongod.conf \/etc\/mongod-rs01-arb.conf<\/p><\/blockquote>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 <i>\/etc\/mongod-rs01-arb.conf<\/i> \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438  <\/p>\n<pre><code class=\"bash\">port=27020 dbpath=\/opt\/mongo-rs01-arb pidfilepath=\/var\/run\/mongodb\/mongod-rs01-arb.pid <\/code><\/pre>\n<p>  \u0418 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\/\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443  <\/p>\n<pre><code class=\"bash\">configsvr=true <\/code><\/pre>\n<p>  \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441  <\/p>\n<blockquote><p># service mongo-rs01-arb start<\/p><\/blockquote>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043d\u0430\u0448 Master \u0434\u043b\u044f rs01, \u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 mongo \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0430\u0440\u0431\u0438\u0442\u0440\u0430 \u0432 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a  <\/p>\n<blockquote><p>&gt; rs.addArb(\u00abmongos01:27020\u00bb)<\/p><\/blockquote>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433  <\/p>\n<blockquote><p>rs01:PRIMARY&gt; rs.conf()<\/p><\/blockquote>\n<p>  <\/p>\n<pre><code class=\"bash\">{         &quot;_id&quot; : &quot;rs01&quot;,         &quot;version&quot; : 7,         &quot;members&quot; : [                 {                         &quot;_id&quot; : 0,                         &quot;host&quot; : &quot;mongo01-rs01:27017&quot;                 },                 {                         &quot;_id&quot; : 1,                         &quot;host&quot; : &quot;mongo02-rs01:27017&quot;,                 },                 {                         &quot;_id&quot; : 2,                         &quot;host&quot; : &quot;mongos01:27020&quot;,                         &quot;arbiterOnly&quot; : true                 }         ] } <\/code><\/pre>\n<p>  \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u044d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0441 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u043f\u043e\u0434 \u0432\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0442\u043e\u0440\u044b\u043c \u0448\u0430\u0440\u0434\u043e\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 (mongo01-rs02 \u0438 mongo02-rs02)<\/p>\n<p>  \u0418 \u0442\u0430\u043a, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 2 \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0434\u0435\u043c \u043d\u0430 mongos01 \u0438 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c mongo (\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 mongos)  <\/p>\n<blockquote><p>&gt; sh.addShard(\u00abrs01\/\/mongo01-rs01:27017,mongo02-rs01:27017\u00bb)<br \/>  &gt; sh.addShard(\u00abrs02\/mongo01-rs02:27017,mongo02-rs02:27017\u00bb)<\/p><\/blockquote>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:  <\/p>\n<blockquote><p>&gt; sh.status()<\/p><\/blockquote>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:  <\/p>\n<pre><code class=\"bash\"> shards:     {  &quot;_id&quot; : &quot;rs01&quot;,  &quot;host&quot; : &quot;rs01\/mongo01-rs01:27017,mongo02-rs01:27017&quot; }     {  &quot;_id&quot; : &quot;rs02&quot;,  &quot;host&quot; : &quot;rs02\/mongo01-rs02:27017,mongo02-rs02:27017&quot; } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u0432 \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b 2 \u0448\u0430\u0440\u0434\u0430<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0448 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0431\u0430\u0437\u0443 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<br \/>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u0430\u0437\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 GridFS  <\/p>\n<blockquote><p>&gt; use filestore<br \/>  &gt; sh.enableSharding(\u00abfilestore\u00bb)<br \/>  &gt; sh.shardCollection(\u00abfilestore.fs.chunks\u00bb, { files_id: 1, n: 1 })<\/p><\/blockquote>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441  <\/p>\n<blockquote><p>&gt; sh.status()<\/p><\/blockquote>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c:   <\/p>\n<pre><code class=\"bash\"> shards:     {  &quot;_id&quot; : &quot;rs01&quot;,  &quot;host&quot; : &quot;rs01\/mongo01-rs01:27017,mongo02-rs01:27017&quot; }     {  &quot;_id&quot; : &quot;rs02&quot;,  &quot;host&quot; : &quot;rs02\/mongo01-rs02:27017,mongo02-rs02:27017&quot;}   databases:     {  &quot;_id&quot; : &quot;admin&quot;,  &quot;partitioned&quot; : false,  &quot;primary&quot; : &quot;config&quot; }     {  &quot;_id&quot; : &quot;test&quot;,  &quot;partitioned&quot; : false,  &quot;primary&quot; : &quot;rs02&quot; }     {  &quot;_id&quot; : &quot;filestore&quot;,  &quot;partitioned&quot; : true,  &quot;primary&quot; : &quot;rs01&quot; }         filestore.fs.chunks             shard key: { &quot;files_id&quot; : 1, &quot;n&quot; : 1 }             chunks:                 rs01    1363                 rs02    103             too many chunks to print, use verbose if you want to force print <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 GridFS \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c mongos<\/p>\n<p>  PS: \u043f\u0440\u043e \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043d\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u044c\u0431\u0430 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043b\u0438\u0447\u043a\u0443,      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/227395\/\"> http:\/\/habrahabr.ru\/post\/227395\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e MongoDB, \u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u043c\u043e\u043d\u0433\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<\/p>\n<p>  \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 MongoDB \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <b>\u0428\u0430\u0440\u0434<\/b><br \/>  \u0428\u0430\u0440\u0434 \u2014 \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441 mongod, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438. \u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 production, \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0440\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0440\u0435\u043f\u043b\u0438\u043a (replicaSet).<\/p>\n<p>  <b>\u0421\u0435\u0440\u0432\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439<\/b><br \/>  \u0422\u0430\u043a \u0436\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 mongod, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. \u041c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u0448\u0430\u0440\u0434\u0435.<\/p>\n<p>  <b>\u0421\u0435\u0440\u0432\u0435\u0440 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438<\/b><br \/>  \u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 mongos. \u0415\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043a \u0448\u0430\u0440\u0434\u0430\u043c.<br \/>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 MongoDB<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/e03\/31f\/205\/e0331f205133e7dd5a7e79fb9f660fe3.png\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-227395","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/227395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=227395"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/227395\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=227395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=227395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=227395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}