Solr4.8.1从Mysql数据库导数据的步骤
来源:互联网 发布:单片机串口工作原理 编辑:程序博客网 时间:2024/06/01 11:53
Solr4.8.1有从Mysql数据库导数据的功能。导入步骤如下:
1.将下载下来的solr4.8.1的dist文件夹下的solr-dataimporthandler-4.8.1.jar和solr-dataimporthandler-extras-4.8.1.jar放入tomcat该路径下:F:\solr\tomcat7.0.52\webapps\solr\WEB-INF\lib
2.修改solrconfig.xml,添加下面这段代码:
<requestHandler name="/dataimport" class="solr.DataImportHandler"> <lst name="defaults"> <str name="config">db-data-config.xml</str> </lst> </requestHandler>
3.然后再solrconfig.xml文件的同目录下新增上面声明的data-config.xml。内容如下:
<dataConfig> <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://10.28.174.65:3306/test?useUnicode=true&characterEncoding=utf-8" user="root" password="123456"/> <document> <entity name="id" query="select id, cid, serviceid, customer, content from chatlogs_jad"></entity> </document> </dataConfig>4.修改schema.xml,修改数据类型定义:
<field name="_version_" type="long" indexed="true" stored="true"/> <field name="_root_" type="string" indexed="true" stored="false"/> <field name="id" type="int" stored="true" indexed="true"/> <field name="cid" type="string" stored="true" indexed="true"/> <field name="serviceid" type="string" stored="true" indexed="true"/> <field name="customer" type="string" stored="true" indexed="true"/> <field name="content" type="string" stored="true" indexed="true"/>
注意,_root_和_version_是必备的,不能少,少了就报错!(_version_有些已经自带不能重复否则报错)
5.重新上传配置文件solrconfig.xml, schema.xmml,data-config.xml
(1)上传solr配置文件
java -classpath .:/home/hadoop/liao/tomcat/webapps/solr/WEB-INF/lib/* org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost master:2181,slave0:2181,slave1:2181,slave2:2181,slave3:2181 -confdir /home/hadoop/liao/solr-home/db/conf -confname myconf我的配置文件在
/home/hadoop/liao/solr-home/db/conf根据每个人的情况自己重新上传
(2)将上传的配置文件和collection联系起来
java -classpath .:/home/hadoop/liao/tomcat/webapps/solr/WEB-INF/lib/* org.apache.solr.cloud.ZkCLI -cmd linkconfig -collection mycollection -confname myconf -zkhost master:2181,slave0:2181,slave1:2181,slave2:2181,slave3:2181
6.重启tomcat。
7.在管理员界面上执行操作:
0 0
- Solr4.8.1从Mysql数据库导数据的步骤
- Solr4.6从数据库导数据的步骤
- Solr4.7以DIH的方式从数据库导数据
- Solr4.7从数据库导数据
- Solr4.7从数据库导数据
- Solr4.7从数据库导数据
- Solr4.7从数据库导数据
- Solr4.7从数据库导数据
- 第三章:Solr4.7以DIH的方式从数据库导数据
- mysql 本地数据库如何从远程数据库导数据,本文以此问题进行详细介绍
- 从mysql导数据到trafodion
- 从mysql数据库中导入数据到solr4.5
- 从mysql数据库中导入数据到solr4.5
- 从mysql数据库中导入数据到solr4.5
- sql2005数据库导数据到mysql中
- solr4.6 从数据库导入
- solr4 mysql数据库导入数据
- solr4 mysql数据库导入数据
- 对Linux inode的一些理解
- c# 汉字转换成ASCII码及ASCII码转换成汉字代码
- mysql bigint类型转化成date类型
- 资讯_谈Win8标准版/专业版/企业版/WinRT区别和不同;
- SVN学习
- Solr4.8.1从Mysql数据库导数据的步骤
- ActionBarActivity环境搭建步骤及遇到的问题总结
- php 正则表达式验证数字
- 大学教育应该教什么
- 使用MVC框架开发-struts2小结
- 使用GetCurrentDirectory()的一个小问题
- ABB机器人ROBOTSTUDIO中轨迹与二次开发的问答
- WebKit Coordinated Graphics System
- 在Ubuntu里配置eclipse具体步骤