My studying notes for Java,Ruby,Ajax and other any interesting things.

星期一, 九月 30, 2013

jstorm从源码构建

 
前置条件:(linux下面安装见前面文档)
java
maven
1.将jstorm从github中clone出来:

2.修改pom.xml,以避免zookeeper的cdh3u0版本无法找 到:
       <repository>
          <id>central2</id>
          <name>libs-release</name>
          <url>https://repository.cloudera.com/artifactory/libs-release</url>
        </repository>
增加:utf8支持,避免本地编码的warning
   <properties>
        <powermock.version>1.4.11</powermock.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

3.然后根据deploy文件进行执行:mvn clean mvn package assembly:assembly

途中会有warning提示:
[WARNING] Assembly file: /home/xxxx/code/java/jstorm/target/jstorm-jstorm is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment.
[WARNING] NOTE: Currently, inclusion of module dependencies may produce unpredictable results if a version conflict occurs.
[WARNING] The following patterns were never triggered in this artifact exclusion filter:
o  'com.alipay.dw:jstorm-client'
o  'com.alipay.dw:jstorm-client-extension'

[WARNING] The following patterns were never triggered in this artifact exclusion filter:
o  'com.alipay.dw:jstorm-client'
o  'com.alipay.dw:jstorm-client-extension'
应该没有什么问题,主要是目录警告和模块依赖警告,在mvn3和mvn2有些区别?

4.package完毕后,会在target目录中生成一个tgz文件: jstorm-jstorm.tar.gz,可以用于部署:

结构如下:
`-- jstorm
    |-- bin --运行路径
    |   `-- jstorm
    |-- conf --配置目录
    |   |-- jstorm.log4j.properties
    |   `-- storm.yaml
    |-- jstorm-client-0.7.1.jar --客户端jar
    |-- jstorm-client-extension-0.7.1.jar --客户端扩展
    |-- jstorm-server-0.7.1.jar --服务jar
    |-- jstorm-ui-0.7.1.war--可以部署在tomcat中用于管理jstorm的运行
    `-- lib--第三方依赖的jar包

构建完毕需要在jstorm的目录中touch RELEASE文件,否则bin/jstorm在执行的时候会报告错误:
******************************************
The jstorm client can only be run from within a release. You appear to be trying to run the client from a checkout of Storm's source code.

You can download a JStorm release 
******************************************

安装zmq和jzmq:
zmq:
tar -xzf zeromq-2.1.7.tar.gz
cd zeromq-2.1.7
./configure
make
sudo make install
jzmq:
#install jzmq
git clone https://github.com/nathanmarz/jzmq.git
cd jzmq
./autogen.sh
./configure
make
sudo make install

建议使用2.1.7,避免导致各种兼容问题。

refer: https://github.com/nathanmarz/storm/wiki/Installing-native-dependencies


本邮件及其附件含有"赶集网"的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!

This e-mail and its attachments contain confidential information from GanJi, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

星期日, 九月 29, 2013

在centos中安装java

近期准 备将一些服务迁移到java环境中来,简单记录一些操作过程。

1.检查是否安装了openjdk,如果是的话,卸载重新安装oracle官方的jdk
java -version --查看java版本号
rpm -qa|grep java  查看rpm中安装的jdk版本信息
java-1.6.0-openjdk-1.6.0.0-1.40.1.11.11.el5_9
tzdata-java-2013c-1.el5
2.卸载默认安装的jdk信息,使用yum即可:
yum -y remove java-1.6.0-openjdk-1.6.0.0-1.40.1.11.11.el5_9
yum -y remove tzdata-java-2013c-1.el5
3.到oracle官方网站中下载jdk信息,通常使用tar.gz包进行安装:
可以通过uname -a查看自己的linux版本,可以下载32或者64位的jdk安装包
4.安装过程:
mkdir /usr/java
cp *.gz /usr/java
cd /usr/java
tar -xvzf jdk-7u13-linux-x64.gz
mv jdk1.7.0_13 jdk
          如果下载的是rpm包的话可以使用:rpm -ivh jdk-7u13-linux-x64.rpm 进行安装
5.修改profile:
vi /etc/profile 
加入:
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export JAVA_HOME=/usr/java/jdk
export PATH=$JAVA_HOME:$PATH
export CLASSPATH=.;$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 

然后执行source /etc/profile,令其当前生效,输入java -version检查是否安装完毕


本邮件及其附件含有"赶集网"的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!

This e-mail and its attachments contain confidential information from GanJi, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!