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
Http://hbase203:8983/solr/#/~cloud
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
Http://hbase203:8983/solr/admin/collections?action=DELETE&name=test
Reload
Http://hbase203:8983/solr/admin/collections?action=RELOAD&name=test
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>
</lst>
Create Data-config.xml
VI Data-config.xml
<dataConfig>
<datasource type= "Jdbcdatasource"
driver= "Com.mysql.jdbc.Driver"
converttype= "True"
url= "Jdbc:mysql://127.0.0.1:3306/db_name"
user= "sa"
password= "123456"/>
< document>
<entity name= "query_news" query= "SELECT ID, title, content, tags from news" >
</entity& gt;
</document>
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
Http://hbase201:8983/solr/admin/collections?action=RELOAD&name=test
Backup and Recovery
Backup
Http://hbase201:8983/solr/test/replication?command=backup&location=/home/test_bak
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>
<int name= "SOLR.HDFS.NRTCACHINGDIRECTORY.MAXCACHEDMB" >192</int>
</directoryFactory>
<lockType>${solr.lock.type:hdfs}</lockType>
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-*
Cd/usr/hadoop/hadoop-2.7.4/share
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/