1 2 3 | tar xf /usr/local/src/zookeeper-3 .4.6. tar .gz -C /usr/local cd /usr/local ln -s zookeeper-3.4.6 zookeeper |
1 | mkdir -p /data/zookeeper/ {data,log} |
1 2 3 4 5 6 7 8 9 10 11 | cd /usr/local/zookeeper/conf cp zoo_sample.cfg zoo.cfg vim zoo.cfg修改如下: tickTime=2000 initLimit=10 syncLimit=5 dataDir= /data/zookeeper/data clientPort=2181 server.1=10.1.12.51:2888:3888 server.2=10.1.12.52:2888:3888 server.3=10.1.12.53:2888:3888 |
1 2 3 4 5 6 | node1: echo 1> /data/zookeeper/data/myid node2: echo 2> /data/zookeeper/data/myid node3: echo 3> /data/zookeeper/data/myid |
1 | echo -e "
ZOO_LOG_DIR=/data/zookeeper/log" >> /usr/local/zookeeper/bin/zkEnv .sh |
1 2 3 4 5 6 7 8 9 10 11 12 13 | /usr/local/zookeeper/bin/zkServer .sh start 添加zookeeper的sysv服务脚本 vim /etc/init .d /zookeeper #!/bin/bash # # chkconfig: 345 30 70 # description: Starts/Stops Apache Zookeeper export ZOO_HOME= /usr/local/zookeeper export ZOO_BIN=$ZOO_HOME /bin export ZOO_SER_BIN=$ZOO_BIN /zkServer .sh $ZOO_SER_BIN $1 |
1 2 3 | chmod +x /etc/init .d /zookeeper chkconfig -add zookeeper chkconfig zookeeper on |
1 2 3 | cd /usr/local/src tar xzf solr-5.3.1.tgz solr-5.3.1 /bin/install_solr_service .sh --strip-components=2 . /install_solr_service .sh solr-5.3.1.tgz -i /usr/local -d /data/solrcloud -u solr -s solr -p 8983 |
1 | echo 'SOLR_JAVA_MEM="-Xms10g -Xmx10g"' >> /data/solrcloud/solr . in .sh |
1 | echo 'ZK_HOST=10.1.12.51:2181,10.1.12.52:2181,10.1.12.53:2181' >> /data/solrcloud/solr . in .sh |
1 2 3 | cp ~ /ik-analyzer-solr5-5 .x.jar /usr/local/solr/server/solr-webapp/webapp/WEB-INF/lib cp -n /usr/local/solr/dist/ *.jar /usr/local/solr/server/solr-webapp/webapp/WEB-INF/lib cp ~ /mysql-connector-java-5 .1.35.jar /usr/local/solr/server/lib |
1 | /etc/init .d /solr restart |
1 2 | su -c '/usr/local/solr/bin/solr create -c core_bingdu -d /opt/core_bingdu_conf -n core_bingdu -s 3 -rf 2 -port 8983' - solr su -c '/usr/local/solr/bin/solr create -c core_bingdu_user -d /opt/core_bingdu_user_conf -n core_bingdu_user -s 3 -rf 2 -port 8983' - solr |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | [root@mongo-shard1-1 opt] # tree . . ├── core_bingdu_conf │ ├── admin-extra.html │ ├── admin-extra.menu-bottom.html │ ├── admin-extra.menu- top .html │ ├── data-config.xml │ ├── dataimport.properties │ ├── _rest_managed.json │ ├── schema.xml │ └── solrconfig.xml └── core_bingdu_user_conf ├── admin-extra.html ├── admin-extra.menu-bottom.html ├── admin-extra.menu- top .html ├── data-config.xml ├── dataimport.properties ├── _rest_managed.json ├── schema.xml └── solrconfig.xml |
1 2 3 | cd /usr/local/solr/server/scripts/cloud-scripts . /zkcli .sh -zkhost 10.1.12.51:2181 -cmd upconfig -confdir /opt/core_bingdu_conf -confname core_bingdu . /zkcli .sh -zkhost 10.1.12.51:2181 -cmd upconfig -confdir /opt/core_bingdu_user_conf -confname core_bingdu_user |
1 2 | . /zkcli .sh -zkhost 10.1.12.51:2181 -cmd putfile /configs/core_bingdu/solrconfig .xml /opt/core_bingdu_conf/solrconfig .xml . /zkcli .sh -zkhost 10.1.12.51:2181 -cmd putfile /configs/core_bingdu_user/solrconfig .xml /opt/core_bingdu_user_conf/solrconfig .xml |
1 | /etc/init .d /solr restart |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | [root@mongo-shard1-1 bin] # ./solr healthcheck -c core_bingdu -z 10.1.12.52:2181 { "collection" : "core_bingdu" , "status" : "healthy" , "numDocs" :180900, "numShards" :3, "shards" :[ { "shard" : "shard1" , "status" : "healthy" , "replicas" :[ { "name" : "core_node2" , "url" : "http://10.1.12.51:8983/solr/core_bingdu_shard1_replica2/" , "numDocs" :60424, "status" : "active" , "uptime" : "2 days, 17 hours, 13 minutes, 9 seconds" , "memory" : "3.4 GB (%36) of 9.6 GB" , "leader" : true }, { "name" : "core_node5" , "url" : "http://10.1.12.53:8983/solr/core_bingdu_shard1_replica1/" , "numDocs" :60424, "status" : "active" , "uptime" : "2 days, 16 hours, 58 minutes, 39 seconds" , "memory" : "2.2 GB (%22.5) of 9.6 GB" }]}, { "shard" : "shard2" , "status" : "healthy" , "replicas" :[ { "name" : "core_node3" , "url" : "http://10.1.12.52:8983/solr/core_bingdu_shard2_replica1/" , "numDocs" :59916, "status" : "active" , "uptime" : "2 days, 17 hours, 14 minutes, 3 seconds" , "memory" : "3 GB (%31.1) of 9.6 GB" , "leader" : true }, { "name" : "core_node6" , "url" : "http://10.1.12.53:8983/solr/core_bingdu_shard2_replica2/" , "numDocs" :59916, "status" : "active" , "uptime" : "2 days, 16 hours, 58 minutes, 39 seconds" , "memory" : "2.2 GB (%22.5) of 9.6 GB" }]}, { "shard" : "shard3" , "status" : "healthy" , "replicas" :[ { "name" : "core_node1" , "url" : "http://10.1.12.51:8983/solr/core_bingdu_shard3_replica1/" , "numDocs" :60560, "status" : "active" , "uptime" : "2 days, 17 hours, 13 minutes, 9 seconds" , "memory" : "3.5 GB (%36) of 9.6 GB" }, { "name" : "core_node4" , "url" : "http://10.1.12.52:8983/solr/core_bingdu_shard3_replica2/" , "numDocs" :60560, "status" : "active" , "uptime" : "2 days, 17 hours, 14 minutes, 3 seconds" , "memory" : "3 GB (%31.2) of 9.6 GB" , "leader" : true }]}]} |
1 | bin /solr create -c core_bingdu -d /opt/core_bingdu_conf -n core_bingdu -s 3 -rf 2 -port 8983 |
1 | bin /solr delete -c core_bingdu |
1 | http: //localhost :8983 /solr/admin/collections ?action=CREATE&name=mycollection&numShards=3&replicationFactor=4 |
1 | http: //localhost :8983 /solr/admin/collections ?action=DELETE&name=mycollection |
1 | http: //localhost :8983 /solr/admin/collections ?action=RELOAD&name=mycollection |
1 | http: //10 .1.12.53:8983 /solr/admin/collections ?action=LIST |
1 | http: //localhost :8983 /solr/admin/collections ?action=SPLITSHARD&collection=anotherCollection&shard=shard1 |
1 | http: //localhost :8983 /solr/admin/collections ?action=CREATEALIAS&name=testalias&collections=anotherCollection,testCollection |
1 | http: //localhost :8983 /solr/admin/collections ?action=DELETEALIAS&name=testalias |
1 | http: //localhost :8983 /solr/admin/collections ?action=DELETEREPLICA&collection=test2&shard=shard2&replica=core_node3 |
1 | http: //localhost :8983 /solr/admin/collections ?action=ADDREPLICA&collection=test2&shard=shard2&node=192.167.1.2:8983_solr |
1 | http: //localhost :8983 /solr/admin/collections ?action=OVERSEERSTATUS&wt=json |
1 | http: //localhost :8983 /solr/admin/collections ?action=clusterstatus&wt=json |
1 | /usr/bin/curl -G "http://10.1.12.53:8983/solr/core_bingdu/dataimport?command=full-import&clean=true&commit=true" 2&> /dev/null |
1 | /usr/bin/curl -G "http://10.1.12.53:8983/solr/core_bingdu_user/dataimport?command=delta-import&clean=false&commit=true" 2&> /dev/null |