杂七杂八的配置

服务器端:

配置单独的zookeeper:

解压zookeeper-3.4.5.tar.gz到任意目录

重命名conf/zoo_sample.cfg --> zoo.cfg

修改其中的dataDir(可选操作)

客户端:

进入 ${SOLR_HOME}/example/cloud-scripts

执行以下命令上传solr配置文件到zk服务器中

./zkcli.sh -zkhost 192.168.32.186:2181 -cmd upconfig -confdir /Applications/eclipse-kepler/workspace/smssolr/solrhome/news/conf -confname news

./zkcli.sh -zkhost 192.168.32.186:2181 -cmd linkconfig -collection news -confname news

Tomcat启动命令添加

-Dfile.encoding=utf-8
-DzkHost=127.0.0.1:2181

context.xml如下

<?xml version="1.0" encoding="UTF-8"?>
<Context>
	<WatchedResource>WEB-INF/web.xml</WatchedResource>
	<!-- 禁用session持久化 -->
	<Manager pathname=""/>
	<!-- jndi数据源配置 -->
	<Resource auth="Container" driverClassName="net.sourceforge.jtds.jdbc.Driver" maxActive="100" maxWait="15000" name="jdbc/ds248" password="password" type="javax.sql.DataSource" url="jdbc:jtds:sqlserver://192.168.0.1/dbname" username="dbuser"/>
	<Resource auth="Container" driverClassName="net.sourceforge.jtds.jdbc.Driver" maxActive="100" maxWait="15000" name="jdbc/ds249" password="password" type="javax.sql.DataSource" url="jdbc:jtds:sqlserver://192.168.0.2/dbname" username="dbuser"/>
	<Environment name="solr/home" type="java.lang.String" value="D:/Java/tomcat-solr-01/webapps/smssolr/solrhome" override="true"/>
</Context>

copy ${SOLR_HOME}/dist/solr.war to ${TOMCAT_HOME}/webapps

copy ${SOLR_HOME/dist/*.jar to ${TOMCAT_HOME}/lib

copy ${SOLR_HOME}/example/lib/ext to ${TOMCAT_HOME}/lib

创建上面环境变量中指定的"solr/home"

copy ${SOLR_HOME}/example/solr/solr.xml to solr/home

启动Tomcat

创建Collection:

http://192.168.32.186:7701/smssolr/admin/collections?action=CREATE&name=news&numShards=2&replicationFactor=1&maxShardsPerNode=2

参考(https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-CreateaCollection)



你可能感兴趣的:(杂七杂八的配置)