设为首页 收藏本站
查看: 1870|回复: 0

[经验分享] solr +zookeeper+tomcat 集群搭建

[复制链接]

尚未签到

发表于 2015-9-7 10:07:31 | 显示全部楼层 |阅读模式
  最近需要搭建一个cloudSolr集群,写下记录。基础环境是在centos6.5 64bit
  3个下载地址:
  1、 下载Solr-4.x http://lucene.apache.org/solr/downloads.html
2、下载Tomcat http://tomcat.apache.org/download-70.cgi
3、下载Zookeeper http://zookeeper.apache.org/releases.html
  第一:安装zookeeper集群
  zookeeper的安装比较简单



记得关闭防火墙,否则会提示启动失败(重要)
chkconfig iptables off 重启后生效
在zoo.cfg配置文件中
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/hadoop/package/zookeeper-3.4.5/data
# the port at which the clients will connect
clientPort=2181
server.1=192.168.0.146:2888:3888  
server.2=192.168.0.142:2888:3888   
server.3=192.168.0.145:2888:3888
需要修改的:
dataDir=/home/hadoop/package/zookeeper-3.4.5/data
里需要创建一个myid文件里面的值是配置文件中server.后的值
如:server.1=192.168.0.146:2888:3888  里面的值是1
  
  第二: 安装tomcat+solr集成
  参照我上篇文章tomcat集成solr
  http://www.cnblogs.com/zhanggl/p/3897105.html
  在主节点147 安装后,复制到148,149 服务器上。
  
  第三zk和solr+tomcat集成
  修改tomcat 下 配置文件:在主192.168.0.157 服务器上的tomcat 目录下bin的
配置文件
  JAVA_OPTS = "
-DzkHost=192.168.0.157:2181,192.168.0.158:2181,192.168.0.159:2181
-Dbootstrap_confdir=/home/hadoop/package/solrhome/collection1/conf -Dcollection.configName=myconf
-Dbootstrap_conf=true
-DnumShards=2"
  在192.168.0.158, 192.168.0.159 服务上的tomcat  bin目录下catalina.sh 添加
  set JAVA_OPTS = -DzkHost=192.168.0.157:2181,192.168.0.158:2181,192.168.0.159:2181
  
  打开后出现错误提示:



Loading of "/solr/zookeeper?wt=json" failed (HTTP-Status 404)
"Zookeeper is not configured for this Solr Core. Please try connecting to an alternate zookeeper address."
  
  
  
  
  
  
  
  
  
  
  
  
  
  将配置文件复制到其他服务器上:
  java -classpath .:/home/hadoop/cloudsolr/tomcat-7.0.55/webapps/solr/WEB-INF/lib/*  org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost 192.168.0.157:2181,1192.168.0.158:2181,192.168.0.159:2181 -confdir /home/hadoop/cloudsolr/solrhome/collection1/conf  -confname myconf
  同步到节点:
  java -classpath .:/home/hadoop/cloudsolr/tomcat-7.0.55/webapps/solr/WEB-INF/lib/*  org.apache.solr.cloud.ZkCLI -cmd linkconfig -collection collection1 -confname myconf -zkhost 192.168.0.157:2181,1192.168.0.158:2181,192.168.0.159:2181
  错误提示:log4j:WARN No appenders could be found for logger (org.apache.zookeeper.ZooKeeper).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  
  错误提示



adoop@slave3 solrlib]$ java -classpath .:/home/hadoop/package/solrlib/*  org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost 192.168.0.157:2181,192.168.0.158:2181,192.168.0.159:2181 -confdir .:/home/hadoop/package/solrconfig -confname myconf
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
at org.apache.solr.common.cloud.SolrZkClient.<clinit>(SolrZkClient.java:72)
at org.apache.solr.cloud.ZkCLI.main(ZkCLI.java:175)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 7 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
at org.apache.solr.common.cloud.SolrZkClient.<clinit>(SolrZkClient.java:72)
at org.apache.solr.cloud.ZkCLI.main(ZkCLI.java:175)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 7 more

  解决办法:下载http://yunpan.cn/cdpSQiMZbfe33 (提取码:49e0) 将jar导入即可
  1、启动的时候错误提示:



Load collection config from:/collections/collection1
2465 [coreLoadExecutor-6-thread-1] ERROR org.apache.solr.common.cloud.ZkStateReader  ?.Specified config does not exist in ZooKeeper:collection1
2469 [coreLoadExecutor-6-thread-1] ERROR org.apache.solr.core.CoreContainer  ?.Error creating core [collection1]: Specified config does not exist in ZooKeeper:collection1
org.apache.solr.common.cloud.ZooKeeperException: Specified config does not exist in ZooKeeper:collection1
  错误原因:
  启动错误提示:



HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure: Could not load conf for core collection1:
Error loading solr config from solr/collection1/conf/solrconfig.xml,trace=org.apache.solr.common.SolrException: SolrCore 'collection1'
is not available due to init failure: Could not load conf for core collection1: Error loading solr config from solr/collection1/conf/solrconfig.xml at

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-110466-1-1.html 上篇帖子: 分布式服务框架 Zookeeper 下篇帖子: 分布式服务框架 Zookeeper
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表