ZKX's LAB

solr怎么把数据库数据导入索引库 solr数据目录

2021-04-06知识5

solr怎么把数据库数据导入索引库 在solr与tomcat整合文章中,我用的索引库是mycore,现在就以这个为例。首先要准备jar包:solr-dataimporthandler-4.8.1.jar、solr-dataimporthandler-extras-4.8.1.jar和mysql-connector-java-5.0.7-bin.jar这三个包到solr的tomcat的webapps\\solr\\WEB-INF\\lib下在这个文件夹的conf下配置两个文件,添加一个文件。先配置solrconfig.xml。在该文件下添加一个新节点。data-config.xml在solrconfig.xml的同目录下创建data-config.xml。配置:复制代码driver=\"com.mysql.jdbc.Driver\"url=\"jdbc:mysql:/localhost:3306/coursemanuser=\"rootpassword=\"mysql\"/>;query=\"SELECT*FROM student\">;复制代码schemal.xml的配置复制代码xml version=\"1.0?Licensed to the Apache Software Foundation(ASF)under one or contributor license agreements.See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License,Version 2.0(the\"License\");you may not use this file except in compliance withthe License。.

solr 有几种导入数据的方式 solr数据导入,经过这几天的查资料,我觉得solr数据导入可以有三种方式:1、编写数据xml文件,通过post.jar导入;2、通过DIH导入;3、利用solrj导入数据;现针对第三种方式进行研究,在第一步中写了一段小的测试代码,可以参考:http://wiki.apache.org/solr/Solrj#Streaming_documents_for_an_update具体的代码解释如下:String url=\"http://localhost:8080/solr\";HttpSolrServer server=new HttpSolrServer(url);If you wish to delete all the data from the index,do thisserver.deleteByQuery(\"*:*\");Construct a documentSolrInputDocument doc1=new SolrInputDocument();doc1.addField(\"id\",\"id1_solrj\");doc1.addField(\"type\",\"doc1_solrj\");doc1.addField(\"name\",\"name1_solrj\");Construct another documentSolrInputDocument doc2=new SolrInputDocument();doc2.addField(\"id\",\"id2\");doc2.addField(\"type\",\"doc2_solrj\");doc2.addField(\"name\",\"name2_solrj\");Create a collection of documentsCollection<;SolrInputDocument>;docs=new ArrayList();docs.add(doc1);docs.add(doc2);Do a committry {server.add(docs);server.commit();} catch。

如何用Solr搭建大数据查询平台 1、解压包solr-4.7.1/dist/solr-4.7.1.war复制tomcat_dir/webapps/目录并命名solr.war2、solr-4.7.1/example/lib/ext/目录jar文件复制tomcat/lib目录solr-4.7.1/example/resources/log4j.properties文件复制tomcat_dir/lib目录;切 solr-4.7.1/example/solr复制tomcat_dir/bin3、修改tomcat_dir/conf/server.xmlconnectionTimeout=\"20000redirectPort=\"8443URIEncoding=\"UTF-8\"/>;4、创建solr.xml存放路径:tomcat/conf/Catalina/localhost/solr.xml内容:debug=\"0\"crossContext=\"true\">;PS:面docBasevalue路径能存文字符否则现404错误5、C:\\Tomcat 7.0\\webappssolr.war包启项目解压;再添加几jar包:solr-4.7.1\\dist\\solr-dataimporthandler-4.7.1.jar;solr-4.7.1\\dist\\solr-dataimporthandler-extras-4.7.1.jar;要加载数据库驱包:mysql-connector-java-3.1.13-bin.jar6、C:\\Tomcat 7.0\\bin\\solr\\collection1\\conf solrconfig.xml增加数据库配置:data-config.xml7、tomcat\\bin\\solr\\collection1\\conf增加data-config.xml文件内容:driver=\"com.mysql.jdbc.Driver\"url=\"jdbc:mysql:/192.168.1.221:3306/tmsdbuser=\"rootpassword=\"123456\"/>;8、。

#solr数据目录

qrcode
访问手机版