本文包含Jstorm在debian安装步骤和错误排查方法,来源于网络上其他各种文章的汇总,感谢广大网友的分享,我也分享自己的总结, 下面的脚本也可以cp 直接执行, 本文省去了zookeeper 的安装步骤,是因为我安装的环境中已经有zookeeper了,有朋友需要安装zookeeper 的请自行在网络上查询相关文章
Jstorm 在Debian上的安装步骤
#####Debian 默认用dash , 这里把dash 改为bash, 避免以后执行sh文件报错#####
ln -fs /bin/bash /bin/sh
#####备份本机的source.lst###
cp /etc/apt/sources.list /etc/apt/sources.list.bk_jstorm
#####拷贝新的source.lst,立即生效,新的source.lst 见下文#####
cp sources.list /etc/apt/sources.list
apt-get update
apt-get install build-essential
#####安装关联包#####
apt-get install gcc
apt-get install libtool*
apt-get install install pkg-config
apt-get install unzip
apt-get install pkg-config
apt-get install autoconf
apt-get install automake
apt-get install python
dpkg -i libuuid-devel_2.27.1-1_amd64.deb
#####安装 Java#####
echo '=================安装 Java 1.7================='
gunzip jdk-7u79-linux-x64.gz
#####配置Java 环境变量#####
echo '===============配置java环境变量= ================='
echo jspath=`pwd`
echo 'export JAVA_HOME=$jspath/jdk1.7.0_79' >> /etc/profile
echo 'export JRE_HOME=/opt/jdk1.7.0_79/jre' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binexport:/sbin:/usr/bin:/usr/sbin CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >> /etc/profile
echo 'export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >> /etc/profile
source /etc/profile
#####验证Java 安装是否成功#####
java -version
javac
#####安装Zeromq#####
echo '=================安装 Zeromq================='
tar -zxf zeromq-2.1.10.tar.gz
cd zeromq-2.1.10
./configure
make
make install
cd $jspath
#####安装Jzmq#####
echo '=================安装 Zeromq================='
tar -zxf zeromq-2.1.10.tar.gz
cd zeromq-2.1.10
./configure
make
make install
cd $jspath
#####安装Jzmq#####
echo '=================安装 Jzmq================='
unzip jzmq-master.zip
cd jzmq-master
./autogen.sh
./configure
make
make install
cd $jspath
#####安装Jstorm#####
#####安装Jstorm#####
echo '=================安装 Jstorm================='
unzip jstorm-0.9.6.2.zip
mv jstorm-0.9.6.2 jstorm
echo 'export JSTORM_HOME=$jspath/jstorm' >> ~/.bashrc
echo 'export PATH=$PATH:$JSTORM_HOME/bin' >> ~/.bashrc
source ~/.bashrc
mkdir ~/.jstorm
echo '================= 配置Jstorm ================='
sed -i '/localhost"$/'d $jspath/jstorm/conf/storm.yaml
sed -i /'storm.zookeeper.servers:/a\ - "192.168.9.94"' $jspath/jstorm/conf/storm.yaml
sed -i /'storm.zookeeper.servers:/a\ - "192.168.9.93"' $jspath/jstorm/conf/storm.yaml
sed -i /'storm.zookeeper.servers:/a\ - "192.168.9.92"' $jspath/jstorm/conf/storm.yaml
sed -i /'storm.zookeeper.root/a\ nimbus.host: "192.168.9.92"' $jspath/jstorm/conf/storm.yaml
cp $JSTORM_HOME/conf/storm.yaml ~/.jstorm
echo '==========Startup Jstorm============'
cd jstorm/bin
nohup ./jstorm nimbus &
echo '=================安装 Jstorm UI================'
tar -xvf tom7.tar
cd apache-tomcat-7.0.67/bin
./start.sh
echo '===================='
cd $jspath
echo `jps`
Jstorm 安装过程错误及解决方法
l 场景1:用apt-get install 安装软件报错
错误信息1:Media change: please insert the disc labeled
错误信息2:E: Package <packagename> has no installation candidate
解决方法:
换源, 用下面的源替换/etc/apt/sources.list
Mv /etc/apt/sources.list /etc/apt/sources.list.bk
Vi /etc/apt/sources.list //创建新的sources.lst 文件,并且cp 以下内容
deb http://mirrors.xmission.com/debian/ testing main non-free contrib
deb http://http.us.debian.org/debian testing main contrib non-free
deb http://ftp.us.debian.org/debian testing main non-free contrib
deb http://mirrors.163.com/ubuntu/ testing main non-free contrib
deb http://mirrors.sohu.com/ubuntu/ testing main non-free contrib
并执行以下命令:
apt-get update
apt-get install build-essential
l 场景2:用apt-get install 安装软件报错
错误信息:E: Sub-process /usr/bin/dpkg returned an error code (1)
解决方法:
cd /var/lib/dpkg
sudo mv info info.bak #即备份一个info
sudo mkdir info #新建一个新的info目录
然后采用以下命令重装那些出错的软件包
apt-get install 软件包名
l 场景3:执行autogen.sh 文件时报错
错误信息:autogen.sh: error: could not find pkg-config.
解决方法:Apt-get install pkg-config
备注:遇到类似错误,均可以用apt-get install 解决,若apt-get install 找不到相关软件,考虑换源(同场景1)或者装离线包
l 场景4:安装jzmq 报错
错误信息:
Making all in src
make[1]: Entering directory '/opt/jzmq/src'
make[1]: *** No rule to make target 'classdist_noinst.stamp', needed by 'org/zeromq/ZMQ.class'. Stop.
make[1]: Leaving directory '/opt/jzmq/src'
Makefile:399: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
解决方法:
touch src/classdist_noinst.stamp
l 场景5:编译jzmq报错
错误信息:
make[1]: *** No rule to make target `org/zeromq/ZMQException.class, needed by `all'. Stop.
make: *** [all-recursive] Error 1
解决方法:
$ cd src/org/zeromq/
$ /jzmq/src/org/zeromq]$ javac *.java
$ cd ..
$ make
$ make install
参考文档:http://my.oschina.net/mingdongcheng/blog/43009
l 场景6:启动jstrom 报错
错误信息:
root@debian:/opt/jstorm/bin# ./start.sh
./start.sh: 5: ./start.sh: source: not found
./start.sh: 52: ./start.sh: Syntax error: "(" unexpected
解决方法
#先看看是用的哪个 shell
ls -al /bin/sh
#如果是 Dash 可用以下方法切回 Bash(选择 NO)
方法一
sudo dpkg-reconfigure dash
方法二
sudo ln -fs /bin/bash /bin/sh
http://blog.csdn.net/robertbaker/article/details/21129517
l 场景7:启动tomcat 报错
错误信息:
Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
解决方法:
ln -s /var/lib/tomcat7/common/ common
ln -s /var/lib/tomcat7/server/ server
ln -s /var/lib/tomcat7/shared/ shared
ln -s /var/lib/tomcat7/conf/ conf
ln -s /var/lib/tomcat7/logs/ logs
mkdir /usr/share/tomcat7/temp
mkdir -p /usr/share/tomcat7/common/classes
mkdir -p /usr/share/tomcat7/server/classes
mkdir -p /usr/share/tomcat7/shared/classes
l 场景8:启动tomcat 报错
错误信息:
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
java.net.BindException: Address already in use <null>:8080
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:413)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:651)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:821)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
Caused by: java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at java.net.ServerSocket.<init>(ServerSocket.java:181)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:400)
... 17 more
解决方法:
端口号被占用,更改端口号
修改tomcat /conf /server.xml 文件
<Connector port="8888" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />