安装视频学习源于 汪文君Apache Storm1.2.2实战 (我用的1.2.3–20210405)
https://www.bilibili.com/video/BV1et41147xq?p=3
1.下载
2.启动zookeeper 这个文章有(貌似不全面,以后完善)https://blog.csdn.net/wei198621/article/details/113832427
3.配置storm 集群
4.启动storm 集群
官网下载地址:
http://storm.apache.org/downloads.html
https://archive.apache.org/dist/storm/apache-storm-1.2.2/
阿里云镜像
国内镜像 最老版本 1.2.3 本示例使用 1.2.3 版本
https://mirrors.aliyun.com/apache/storm/apache-storm-1.2.3/
清华镜像
https://mirrors.tuna.tsinghua.edu.cn/apache/storm/
规范:
usr/local 放第三方框架
opt/ 放jdk maven ant 等底层的包
var/lib 动态库
[root@storm52 ~]# ll
total 165144
-rw-r--r--. 1 root root 169095091 Apr 5 07:32 apache-storm-1.2.3.tar.gz
[root@storm52 ~]# tar -zxvf apache-storm-1.2.3.tar.gz -C /usr/local
[root@storm52 local]# ls
apache-storm-1.2.3 etc include lib libexec share
bin games java lib64 sbin src
[root@storm52 local]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# storm
192.168.121.51 master node51
192.168.121.52 slave01 node52
192.168.121.53 slave02 node53
# zookeeper
192.168.121.111 zk1
192.168.121.112 zk2
192.168.121.113 zk3
----- 验证 hosts 是否配置成功
[root@storm52 local]# ping node51
PING node51 (192.168.121.51) 56(84) bytes of data.
64 bytes from node51 (192.168.121.51): icmp_seq=1 ttl=64 time=0.484 ms
64 bytes from node51 (192.168.121.51): icmp_seq=2 ttl=64 time=0.260 ms
创建一个软连接 storm 直接指向具体版本,以后升级 直接 替换软连接就可以
[root@storm52 local]# ln -svnf apache-storm-1.2.3/ storm
[root@storm52 local]# pwd
/usr/local
[root@storm52 local]# ll
total 0
drwxr-xr-x. 12 root root 236 Apr 5 07:48 apache-storm-1.2.3
drwxr-xr-x. 2 root root 6 Apr 10 2018 src
lrwxrwxrwx. 1 root root 19 Apr 5 08:00 storm -> apache-storm-1.2.3/
/var/lib/storm
mkdir -p /var/lib/storm
[root@storm52 local]# vim /etc/profile
export STORM_HOME=/usr/local/storm
export PATH=$STORM_HOME/bin:$PATH
--------------别忘记 source
[root@storm52 local]# source /etc/profile
之前配置的zk 分别是 192.168.121.111 112 113 ,监控端口 3001
启动脚本在 kafka 192.168.121.131 上面
[root@kafka01 bin]# pwd
/usr/local/bin
[root@kafka01 bin]# ll
total 16
-rwxr--r--. 1 root root 466 Mar 28 01:51 ctlkafkaauto.sh
-rwxr--r--. 1 root root 394 Mar 28 01:41 ctlzookeeperauto.sh
lrwxrwxrwx. 1 root root 36 Mar 28 00:27 jps -> /usr/local/java/jdk1.8.0_251/bin/jps
-rwxr--r--. 1 root root 154 Mar 28 00:24 xcallkafka.sh
-rwxr--r--. 1 root root 145 Mar 28 01:00 xcallzk.sh
具体启动脚本是:
/root/zookeeper-3.4.12/bin/zkServer.sh start /root/zkdata/zoo.cf
----- 查看具体启动脚本
[root@kafka01 bin]# cat ctlzookeeperauto.sh
---- 执行启动
[root@kafka01 bin]# sh ctlzookeeperauto.sh start
验证zookeeper 是否启动成功
---验证zookeeper 是否启动成功
[root@zk1 ~]# netstat -na|grep 3001
tcp6 0 0 :::3001 :::* LISTEN
-----进入zookeeper 看其监控了哪些内容
[root@zk1 zookeeper-3.4.12]# pwd
/root/zookeeper-3.4.12
[root@zk1 zookeeper-3.4.12]# bin/zkCli.sh -server 192.168.121.111:3001
...
...
[zk: 192.168.121.111:3001(CONNECTED) 0] ls /
[cluster, controller_epoch, brokers, zookeeper, admin, isr_change_notification, consumers, latest_producer_id_block, config]
[zk: 192.168.121.111:3001(CONNECTED) 1]
[root@storm51 conf]# pwd
/usr/local/storm/conf
[root@storm51 conf]# ll
total 16
-rw-r--r--. 1 503 games 1128 May 4 2019 storm_env.ini
-rwxr-xr-x. 1 503 games 930 May 4 2019 storm-env.ps1
-rwxr-xr-x. 1 503 games 947 May 4 2019 storm-env.sh
-rw-r--r--. 1 503 games 3813 May 4 2019 storm.yaml--------要配置的yaml 文件
进入官网 documentiton 1.2.3 文件夹下
http://storm.apache.org/releases/1.2.3/index.html
选择 Configuration 找到default.yaml 见下图
http://storm.apache.org/releases/1.2.3/Configuration.html
会进入github
https://github.com/apache/storm/blob/v1.2.3/conf/defaults.yaml
[root@storm51 conf]# pwd
/usr/local/storm/conf
[root@storm51 conf]# vim storm.yaml
######### leo configuration start
storm.local.dir: "/var/lib/storm"
storm.zookeeper.servers:
- "zk1"
- "zk2"
- "zk3"
storm.zookeeper.port: 3001
nimbus.seeds : ["node51"]
supervisor.slots.ports:
- 6700
- 6701
- 6702
- 6703
ui.host: 0.0.0.0
ui.port: 8080
######### leo configuration end
进入官网,找到 command line client
http://storm.apache.org/releases/1.2.3/index.html
启动storm (&表示以后台方式运行)
主节点: strom nimbus &
从节点: storm supervisor &
UI: storm ui &
log: storm logviewer &
51 是nimbus
-------后台启动 nimbus
[root@storm51 /]# storm nimbus &
[1] 68108
[root@storm51 /]# jps
68144 Jps
68123 config_value
---------------表示成功启动 nimbus
[root@storm51 /]# Running: /usr/local/java/jdk1.8.0_251/bin/java -server -Ddaemon.name=nimbus -Dstorm.options= -Dstorm.home=/usr/local/apache-storm-1.2.3 -Dstorm.log.dir=/usr/local/apache-storm-1.2.3/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -cp /usr/local/apache-storm-1.2.3/*:/usr/local/apache-storm-1.2.3/lib/*:/usr/local/apache-storm-1.2.3/extlib/*:/usr/local/apache-storm-1.2.3/extlib-daemon/*:/usr/local/storm/conf -Xmx1024m -Dlogfile.name=nimbus.log -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j.configurationFile=/usr/local/apache-storm-1.2.3/log4j2/cluster.xml org.apache.storm.daemon.nimbus
[root@storm51 ~]# jps
18145 nimbus ------nimbus 成功启动
18410 Jps
52 53 是 supervisor
[root@storm52 local]# storm supervisor &
[1] 66884
----------表示成功启动 supervisor
[root@storm52 local]# jps
66907 config_value
66941 Jps
[root@storm52 local]# Running: /usr/local/java/jdk1.8.0_251/bin/java -server -Ddaemon.name=supervisor -Dstorm.options= -Dstorm.home=/usr/local/apache-storm-1.2.3 -Dstorm.log.dir=/usr/local/apache-storm-1.2.3/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -cp /usr/local/apache-storm-1.2.3/*:/usr/local/apache-storm-1.2.3/lib/*:/usr/local/apache-storm-1.2.3/extlib/*:/usr/local/apache-storm-1.2.3/extlib-daemon/*:/usr/local/storm/conf -Xmx256m -Dlogfile.name=supervisor.log -Dlog4j.configurationFile=/usr/local/apache-storm-1.2.3/log4j2/cluster.xml org.apache.storm.daemon.supervisor.Supervisor
[root@storm52 ~]# jps
18820 Jps
18490 Supervisor ------- supervisor 成功启动
---- 53 同 52
[root@storm53 local]# storm supervisor &
[1] 67244
查看日志
[root@storm51 /]# cd /usr/local/storm/logs
[root@storm51 logs]# ll
total 148
-rw-r--r--. 1 root root 0 Apr 5 09:14 access-nimbus.log
-rw-r--r--. 1 root root 0 Apr 5 09:14 access-web-nimbus.log
-rw-r--r--. 1 root root 149685 Apr 5 09:16 nimbus.log
-rw-r--r--. 1 root root 0 Apr 5 09:14 nimbus.log.metrics
51 上面启动ui
-----------(&表示以后台方式运行)
[root@storm51 logs]# storm ui &
[1] 72456
[root@storm51 logs]# jps -l
72550 org.apache.storm.command.config_value
72568 sun.tools.jps.Jps
[root@storm51 logs]# Running: /usr/local/java/jdk1.8.0_251/bin/java -server -Ddaemon.name=ui -Dstorm.options= -Dstorm.home=/usr/local/apache-storm-1.2.3 -Dstorm.log.dir=/usr/local/apache-storm-1.2.3/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -cp /usr/local/apache-storm-1.2.3/*:/usr/local/apache-storm-1.2.3/lib/*:/usr/local/apache-storm-1.2.3/extlib/*:/usr/local/apache-storm-1.2.3/extlib-daemon/*:/usr/local/apache-storm-1.2.3:/usr/local/storm/conf -Xmx768m -Dlogfile.name=ui.log -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j.configurationFile=/usr/local/apache-storm-1.2.3/log4j2/cluster.xml org.apache.storm.ui.core
[root@storm51 logs]# jps
72456 core
72760 Jps
验证
http://192.168.121.51:8080/index.html
[root@storm51 ~]# cd /usr/local/storm/logs
[root@storm51 logs]# ll
total 732
-rw-r--r--. 1 root root 0 Apr 5 09:14 access-nimbus.log
-rw-r--r--. 1 root root 0 Apr 5 09:24 access-ui.log
-rw-r--r--. 1 root root 0 Apr 5 09:14 access-web-nimbus.log
-rw-r--r--. 1 root root 25175 Apr 5 10:04 access-web-ui.log
-rw-r--r--. 1 root root 516645 Apr 5 10:03 nimbus.log
-rw-r--r--. 1 root root 0 Apr 5 09:14 nimbus.log.metrics
-rw-r--r--. 1 root root 156821 Apr 5 10:04 ui.log
-rw-r--r--. 1 root root 0 Apr 5 09:24 ui.log.metrics
----- 发现原因是 视频中的zookeeper 与 storm 在同一台机器,我的zk是在另外三台,修改zk 就好
[root@storm51 logs]# more nimbus.log
2021-04-05 09:14:36.141 o.a.s.s.o.a.z.ClientCnxn main-SendThread(node53:3001) [INFO] Socket error occurred: node52/192.168.121.52:3001: Connection refused
2021-04-05 09:14:36.163 o.a.s.s.o.a.z.ClientCnxn main-SendThread(node52:3001) [INFO] Opening socket connection to server node51/192.168.121.51:3001. Will not attempt to authenticate using SASL (unknown error)
2021-04-05 09:14:36.163 o.a.s.s.o.a.z.ClientCnxn main-SendThread(node52:3001) [INFO] Socket error occurred: node51/192.168.121.51:3001: Connection refused
在本地主机window 上面配置
C:\Windows\System32\drivers\etc\hosts
#storm
192.168.121.51 master node51
192.168.121.52 slave01 node52
192.168.121.53 slave02 node53
-----都可以访问
http://master:8080/index.html
http://node51:8080/index.html
http://node51:8080/index.html
[root@storm51 ~]# storm list
Running: /usr/local/java/jdk1.8.0_251/bin/java -client -Ddaemon.name= -Dstorm.options= -Dstorm.home=/usr/local/apache-storm-1.2.3 -Dstorm.log.dir=/usr/local/apache-storm-1.2.3/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -cp /usr/local/apache-storm-1.2.3/*:/usr/local/apache-storm-1.2.3/lib/*:/usr/local/apache-storm-1.2.3/extlib/*:/usr/local/apache-storm-1.2.3/extlib-daemon/*:/usr/local/storm/conf:/usr/local/apache-storm-1.2.3/bin org.apache.storm.command.list
5349 [main] INFO o.a.s.u.NimbusClient - Found leader nimbus : master:6627
No topologies running.
[root@storm52 ~]# storm logviewer &
[2] 25188
[root@storm52 ~]# Running: /usr/local/java/jdk1.8.0_251/bin/java -server -Ddaemon.name=logviewer -Dstorm.options= -Dstorm.home=/usr/local/apache-storm-1.2.3 -Dstorm.log.dir=/usr/local/apache-storm-1.2.3/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -cp /usr/local/apache-storm-1.2.3/*:/usr/local/apache-storm-1.2.3/lib/*:/usr/local/apache-storm-1.2.3/extlib/*:/usr/local/apache-storm-1.2.3/extlib-daemon/*:/usr/local/apache-storm-1.2.3:/usr/local/storm/conf -Xmx128m -Dlogfile.name=logviewer.log -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j.configurationFile=/usr/local/apache-storm-1.2.3/log4j2/cluster.xml org.apache.storm.daemon.logviewer
[root@storm52 ~]# jps
25747 Jps
25188 logviewer -------logviewer 成功启动
18410 Supervisor
[root@storm52 ~]#
http://slave01:8000/daemonlog?file=supervisor.log
- zookeeper
- nimbus
- supervisor
- ui
- log
1. zookeeper
----192.168.121.131 kafka01 上面有启动zk 的脚本,以后调整
[root@kafka01 bin]# pwd
/usr/local/bin
[root@kafka01 bin]# ll
total 16
-rwxr--r--. 1 root root 466 Mar 28 01:51 ctlkafkaauto.sh
-rwxr--r--. 1 root root 394 Mar 28 01:41 ctlzookeeperauto.sh
lrwxrwxrwx. 1 root root 36 Mar 28 00:27 jps -> /usr/local/java/jdk1.8.0_251/bin/jps
-rwxr--r--. 1 root root 154 Mar 28 00:24 xcallkafka.sh
-rwxr--r--. 1 root root 145 Mar 28 01:00 xcallzk.sh
[root@kafka01 bin]# ctlzookeeperauto.sh start
2. storm nimbus & ----storm51 master 上面执行
3. storm supervisor & ----storm52 ,53 两台 supervisor 上面执行
4. storm ui & ----storm51 master 上面执行
[root@storm51 ~]# jps
11489 core
18145 nimbus
33569 Jps
5. storm logviewer & ----storm52 ,53 两台 supervisor 上面执行
[root@storm53 ~]# jps
26614 logviewer
18490 Supervisor
26954 Jps