1. Configure the solr application and solrhome (port, the solrhome address configured in the web.xml of the solr application)
Configure the service ip and port in solrhome.
2. Configure JAVA_OPTS
JAVA_OPTS="-DzkHost=192.168.25.154:2181,192.168.25.154:2182,192.168.25.154:2183" The ip in red font represents the ip and port number of the zookeeper cluster
3. Submit the solr configuration to zookeper (I don't understand the function of this step)
./zkcli.sh -zkhost 192.168.25.154:2181,192.168.25.154:2182,192.168.25.154:2183 -cmd upconfig -confdir /usr/local/solrcloud/solrhome1/collection1/conf -confname myconf
The ip in the red font part represents the ip address of the zookeeper cluster and the corresponding port.
Check whether the configuration file is uploaded successfully (Note: it is to view the configuration in zookeeper, so zkCli.sh is the file under zookeeper bin):
[root@bogon bin]# ./zkCli.sh
Connecting to localhost:2181
[zk: localhost:2181(CONNECTED) 0] ls /
[configs, zookeeper]
[zk: localhost:2181(CONNECTED) 1] ls /configs
[myconf]
[zk: localhost:2181(CONNECTED) 2] ls /configs/myconf
[admin-extra.menu-top.html, currency.xml, protwords.txt, mapping-FoldToASCII.txt, _schema_analysis_synonyms_english.json, _rest_managed.json, solrconfig.xml, _schema_analysis_stopwords_english.json, stopwords.txt, lang, spellings.txt, mapping-ISOLatin1Accent.txt, admin-extra.html, xslt, synonyms.txt, scripts.conf, update-script.js, velocity, elevate.xml, admin-extra.menu-bottom.html, clustering, schema.xml]
[zk: localhost:2181(CONNECTED) 3]
solrcloud another way
http://www.cnblogs.com/zl0372/p/6444881.html
cd /Users/fengbin/soft/solr/solr-6.4.1/server/scripts/cloud-scripts
The script under solr updates the configuration testsolrconfig to the configuration file
./zkcli.sh -zkhost 127.0.0.1:2181 -cmd upconfig -confdir /Users/fengbin/soft/solr/solrhome1/testsolr/conf/ -confname testsolrconfig
-------Create order details configuration---------
cd /Users/fengbin/soft/solr/solr-6.4.1/server/scripts/cloud-scripts
./zkcli.sh -zkhost 127.0.0.1:2181 -cmd upconfig -confdir /Users/fengbin/soft/solr/solrhome1/orderDetail/conf -confname orderDetailConf
http://localhost:8980/solr/admin/collections?action=CREATE&name=orderDetailSolr&numShards=2&replicationFactor=2&collection.configName=orderDetailConf
删除collections
http://localhost:8980/solr/admin/collections?action=DELETE&name=collection2
具体参见:http://www.cnblogs.com/append/p/5747956.html
http://blog.csdn.net/zwx19921215/article/details/38428099
solrCloud相关概念理解
http://www.bubuko.com/infodetail-940759.html