solr7.5.0_rehat6.5部署
原创大约 2 分钟
solr7.5.0_rehat6.5部署
这篇记录发生在
2018-12-28
, 下面内容不做整理仅作记录,待后续在有solr需求的时候做参考。
当有新的记录后此记录可能会删除
记录
#cat /etc/issue
Red Hat Enterprise Linux Server release 6.5 (Santiago)
===========================================
tar zxvf solr-7.5.0.tgz
===========================================
It should be set to 65000 to avoid operational disruption.
vim /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
reboot
* 标示所有用户
===========================================
groupadd solr
useradd solr -g solr -p solr@solr#
#userdel solr
chown -R solr:solr solr-7.5.0
===========================================
su solr ./bin/solr start
./bin/solr create -c issp
solr-dataimporthandler-7.5.0.jar
solr-dataimporthandler-extras-7.5.0.jar
mysql-connector-java-5.1.46.jar
复制到 /usr/issp/solr-7.5.0/server/solr-webapp/webapp/WEB-INF/lib
===========================================
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">db-data-config.xml</str>
</lst>
</requestHandler>
===========================================
db-data-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
<dataSource typ="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://xxx.xxx.xxx.xxx:/example" ?characterEncoding=utf-8"
user="readonly"
password="readonly"
/>
<document>
<!--name 使用数据库的表名 -->
<entity dataSource="JdbcDataSource" name="t_org_info" pk="org_id" query="select
org_id,
org_name,
Org_Code,
Social_Credit_Code,
legal_rep,
Reg_Capital,
open_date,
Reg_Addr,
Modified_Time,
(case Data_Type when '1' then '单位' when '2' then '自然人' end) Data_Type
from `t_org_info`"
deltaQuery="select org_id from t_org_info where Modified_Time > '${dataimporter.last_index_time}'>
<!--column 是数据库的表的列,name 是solr中的列名 需要在manage-schema中配置规则 -->
<field column="org_id" name="id"/>
<field column="org_name" name="record_num"/>
<field column="Org_Code" name="standard_num"/>
<field column="Social_Credit_Code" name="standard_zh_name"/>
<field column="legal_rep" name="standard_en_name"/>
<field column="Reg_Capital" name="standard_en_name"/>
<field column="open_date" name="id"/>
<field column="Reg_Addr" name="record_num"/>
<field column="Modified_Time" name="standard_num"/>
<field column="Data_Type" name="standard_zh_name"/>
</entity>
</document>
</dataConfig>
其他参考
https://wiki.apache.org/solr/FrontPage
https://www.w3cschool.cn/solr_doc/list/
https://www.w3cschool.cn/solr_doc/solr_doc-t3642fkr.html
#solr发布成服务(生产)
tar xzf solr-7.0.0.tgz solr-7.0.0/bin/install_solr_service.sh --strip-components=2
https://www.w3cschool.cn/solr_doc/solr_doc-mz9a2frh.html
https://wiki.apache.org/solr/IntegratingSolr
===========================================
/local/solr-7.5.0/server/solr
===========================================
{
"authentication":{
"blockUnknown":true,
"class":"solr.BasicAuthPlugin",
"credentials":{"solr":"+teCbmLN/+vqSQ5T0HOHW848I="},
"":{"v":0}},
"authorization":{
"class":"solr.RuleBasedAuthorizationPlugin",
"permissions":[{
"name":"security-edit",
"role":"admin"}],
"user-role":{"solr":"admin"}}}
===========================================
curl --user solr:SolrRocks http://localhost:8983/solr/admin/authentication -H 'Content-type:application/json' -d '{
"set-user": {"solr" : "solr_admin"}}'
===========================================
修改solr服务器时区
solr.in.sh
SOLR_TIMEZONE="CCT"
https://stackoverflow.com/questions/39657868/solr-last-index-time-difference-timezone-format-so-output-is-wrong
https://zhidao.baidu.com/question/94473858.html