CENTOS7 Solr6.6 Cluster deployment

Source: Internet
Author: User
Tags solr zookeeper zookeeper client
Zookeeper Configuration SOLR

Add ZK Address

VI bin/solr.in.sh
# Set The ZooKeeper connection string if using an external ZooKeeper ensemble
# e.g. Host1:2181,host2:2181/chroot
# Leave empty if not using Solrcloud
zk_host= "HBASE201:2181,HBASE202:2181,HBASE203:2181/SOLR"

# Set the ZooKeeper Client timeout (for Solrcloud mode)
zk_client_timeout= "15000"

Uploading a configuration file

./zkcli.sh-zkhost Hbase201,hbase202,hbase203:2181/solr-cmd upconfig-confdir/usr/solr/solr-6.6.0/server/solr/ Configsets/data_driven_schema_configs/conf-confname SOLR

Synchronizing to other servers

Scp-r/usr/solr hbase201:/usr/
scp-r/USR/SOLR hbase202:/usr/

Start the SOLR service separately

BIN/SOLR Start-force
Cluster Operations

View status


Create a cluster

Http://hbase203:8983/solr/admin/collections?action=CREATE&name=test&numShards=3&replicationFactor= 3&maxshardspernode=3&collection.configname=solr

Deleting a cluster



Update configuration file, add Dih

Modify Solrconfig.xml

VI Solrconfig.xml
<lib dir= "${solr.install.dir: /.. /.. /..} /dist/"regex=" Solr-dataimporthandler-.*\.jar "/>  
<requesthandler name= "/dataimport" class= "SOLR. Dataimporthandler ">  
  <lst name=" Defaults ">  
    <str name=" config ">data-config.xml</str>  

Create Data-config.xml

VI Data-config.xml
  <datasource type= "Jdbcdatasource"  
              driver= "Com.mysql.jdbc.Driver"  
              converttype= "True"  
              url= "Jdbc:mysql://"  
              user= "sa"  
              password= "123456"/>  
  < document>  
    <entity name= "query_news" query= "SELECT ID, title, content, tags from news" >  
    </entity& gt;  

Create Schema.xml

VI Schema.xml
<schema name= "Query_news" > <uniqueKey>id</uniqueKey> <field name= "id" type= "int" indexed= "true" Stored= "true" required= "true" multivalued= "false"/> <field name= "title" Type= "string" indexed= "true" stored= " True "required=" true "multivalued=" false "/> <field name=" Content "type=" string "indexed=" true "stored=" true "req Uired= "false" multivalued= "false"/> <field name= "tags" type= "string" indexed= "true" stored= "false" required= " False "multivalued=" false "/> <field name=" _version_ "type=" Long "indexed=" true "stored=" true "/> <field n Ame= "Info_text" type= "Text_general" indexed= "true" stored= "false" multivalued= "true"/> <copyfield source= " Title "dest=" Info_text "/> <copyfield source=" content "dest=" Info_text "/> <copyfield source=" tags "dest=" Info_text "/> <fieldtype name=" string "class=" SOLR. Strfield "sortmissinglast=" true "/> <fieldtype name=" int "class=" SOLR. Trieintfield "precisionstep= "0" positionincrementgap= "0"/> <fieldtype name= "text_general" class= "SOLR. TextField "positionincrementgap=" > <analyzer type= "index" > <tokenizer class= "SOLR. Standardtokenizerfactory "/> <filter class=" SOLR. Lowercasefilterfactory "/> </analyzer> <analyzer type=" Query "> <tokenizer class=" SOLR. Standardtokenizerfactory "/> <filter class=" SOLR. Lowercasefilterfactory "/> </analyzer> </fieldType> </schema>

Uploading a configuration file

./zkcli.sh-zkhost Hbase201,hbase202,hbase203:2181/solr-cmd putfile/configs/solr/solrconfig.xml/usr/solr/ Solr-6.6.0/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml
./zkcli.sh-zkhost hbase201 , Hbase202,hbase203:2181/solr-cmd putfile/configs/solr/data-config.xml/usr/solr/solr-6.6.0/server/solr/ Configsets/data_driven_schema_configs/conf/data-config.xml
./zkcli.sh-zkhost hbase201,hbase202,hbase203 : 2181/solr-cmd Putfile/configs/solr/schema.xml/usr/solr/solr-6.6.0/server/solr/configsets/data_driven_schema_ Configs/conf/schema.xml

Update configuration file

Backup and Recovery



Recover stop SOLR Service copy backup file to Coreindex directory start SOLR Service index store as HDFs

Modify Solrconfig.xml

VI Solrconfig.xml
<directoryfactory name= "Directoryfactory" class= "SOLR. Hdfsdirectoryfactory ">
  <str name=" Solr.hdfs.home ">hdfs://hbase201:9000/solr</str>
  < BOOL Name= "solr.hdfs.blockcache.enabled" >true</bool>
  <int name= "Solr.hdfs.blockcache.slab.count" >1</int>
  <bool name= "solr.hdfs.blockcache.direct.memory.allocation" >true</bool>
  <int name= "Solr.hdfs.blockcache.blocksperbank" >16384</int>
  <bool name= " Solr.hdfs.blockcache.read.enabled ">true</bool>
  <bool name=" solr.hdfs.nrtcachingdirectory.enable ">true</bool>
  <int name=" Solr.hdfs.nrtcachingdirectory.maxmergesizemb ">16</int>

Upload configuration file to zookeeper

./zkcli.sh-zkhost Hbase201,hbase202,hbase203:2181/solr-cmd putfile/configs/solr/data-config.xml/usr/solr/ Solr-6.6.0/server/solr/configsets/data_driven_schema_configs/conf/data-config.xml

Update Hadoop processing jar package (SOLR comes with version inconsistency)

Rm-f server/solr-webapp/webapp/web-inf/lib/hadoop-*
rm-f server/solr-webapp/webapp/web-inf/lib/ protobuf-java-*
CP hadoop/common/hadoop-common-2.7.4.jar/usr/solr/solr-6.6.0/server/solr-webapp/webapp/web-inf/lib/
CP hadoop/common/lib/hadoop-*/usr/solr/solr-6.6.0/server/solr-webapp/webapp/web-inf/lib/
CP hadoop/common/lib/ protobuf-java-2.5.0.jar/usr/solr/solr-6.6.0/server/solr-webapp/webapp/web-inf/lib/
CP hadoop/hdfs/ hadoop-hdfs-2.7.4.jar/usr/solr/solr-6.6.0/server/solr-webapp/webapp/web-inf/lib/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.