dubbo学习指南

一、注册中心(zookeeper)的安装(CentOS6.7下)

1.在系统的/etc/hosts中添加

# zookeeper servers

192.168.1.105 edu-provider-01
2.到apache官网下载zookeeper,例如:

$ wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

3.解压zookeeper安装包
$ tar -zxvf zookeeper-3.4.6.tar.gz
4.在/home/CentOS6.7/zookeeper/zookeeper-3.4.6目录下创建一下目录
$ cd /home/CentOS6.7/zookeeper/zookeeper-3.4.6
$ mkdir data
$ mkdir logs

5.将zookeeper-3.4.6/conf目录下的zoo_sample.cfg文件拷贝一份,命名zoo.cfg
$ cp zoo_sample.cfg zoo.cfg

6.修改zoo.cfg配置文件,添加
$ vi zoo.cfg
dataDir=/home/CentOS6.7/zookeeper/zookeeper-3.4.6/data
dataLogDir=/home/CentOS6.7/zookeeper/zookeeper-3.4.6/logs
clientPort=2181
server.1=edu-provider-01:2888:3888

7.在dataDir=/home/CentOS6.7/zookeeper/zookeeper-3.4.6/data下创建myid文件
$ vi myid

1

8.CentOS6.7用户下修改vi /home/CentOS6.7/.bash_profile,增加zookeeper配置:
$ vi /home/CentOS6.7/.bash_profile

#zookeeper evn

export ZOOKEEPER_HOME=/home/CentOS6.7/zookeeper-3.4.6

export PATH=$ZOOKEEPER_HOME/bin:$PATH

使配置文件生效
$ source /home/CentOS6.7/.bash_profile

9.在防火墙中打开要用的2181、2888、3888,切换到root,执行

# chkconfig iptables on

# service iptables start

# vi /etc/sysconfig/iptables

增加以下三行:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2181 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2888 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3888 -j ACCEPT

重启防火墙
# service iptables restart

查看防火墙端口状态
# service iptables status

10.启动zookeeper:进入到安装目录的bin下,执行:
$ zkServer.sh start
输入jps命令查看进程
24897 QuorumPeerMain
24914 Jps

QuorumPeerMain为zookeeper进程,启动正常
关闭zookeeper:
$ zkServer.sh stop

注:安装zookeeper前,需要安装jdk,具体步骤:
1.下载jdk,解压到本地的目录下(本人放在/home/CentOS6.7/java下)

2.设置jdk环境

这里采用全局设置方法,就是修改etc/profile,它是是所有用户的共用的环境变量

$ sudo gedit /etc/profile

打开之后在末尾添加
$ export JAVA_HOME=/home/CentOS6.7/java/jdk1.7.0_45
$ export JRE_HOME=/home/CentOS6.7/java/jdk1.7.0_45/jre
$ export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
$ export PATH=$JAVA_HOME/bin: $PATH



你可能感兴趣的:(jdk,zookeeper,centos,DUBBO)