日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

基于centos7 搭建storm1.2.3集群过程

發布時間:2024/1/1 编程问答 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 基于centos7 搭建storm1.2.3集群过程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.環境準備

申請3臺測試環境,IP地址如下:

192.168.162.201 m162p201 192.168.162.202 m162p202 192.168.162.203 m162p203

1.1 修改hosts

vim編譯 /etc/hosts 分別在每臺服務器上增加對應的hosts配置

#在192.168.162.201 上配置 192.168.162.201 m162p201#在192.168.162.202 上配置 192.168.162.202 m162p202#在192.168.162.203 上配置 192.168.162.203 m162p203

查看

1.2更新yum repo

可選用的 清華大學軟件站
https://mirror.tuna.tsinghua.edu.cn/help/centos/
或者阿里云 http://mirrors.aliyun.com/

一般需要安裝的 CentOS-Base.repo

# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # #[base] name=CentOS-$releasever - Base baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#released updates [updates] name=CentOS-$releasever - Updates baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

用上文中的內容,替換原有的centos-base.repo
之后 epel 包需要安裝

yum makecache yum install -y epel

然后修改epel的內容為期望的鏡像源。

mv epel.repo epel.repo.bakvim epel.repo

然后增加如下內容:

[epel] name=Extra Packages for Enterprise Linux 7 - $basearch baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7[epel-debuginfo] name=Extra Packages for Enterprise Linux 7 - $basearch - Debug baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1[epel-source] name=Extra Packages for Enterprise Linux 7 - $basearch - Source baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/SRPMS #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1

都更新之后,執行yum -y update 將yum的源更新為最新。

2.安裝基礎軟件

2.1 工具類軟件

個人認為比較常用的一些軟件為:
lsb_release 紅帽默認會有這個命令,能方便查看操作系統信息,centos是不帶的,需要自行安裝:

yum install -y redhat-lsb

2.2 監控類軟件

監控類軟件 nmon atop htop iotop

yum -y install nmon atop htop iotop

2.3 故障分析類軟件

故障分析類軟件 telnet mtr

yum -y install telnet mtr

2.4 基礎類庫

安裝基礎類庫,glibc-headers openssl-devel bzip2-devel readline-devel sqlite-devel bison cmake
注意,CentOS會帶很多基礎包,但都不是devel版本,安裝devel版本是為了后續需要根據源碼編譯安裝軟件來試用,如根據源碼安裝mysql等,就需要很多基礎庫。

yum install sqlite-devel yum install glibc-headers -y yum install gcc-c++ -y yum install openssl-devel -y yum install readline-devel -y yum install bzip2-devel -y yum install bison cmake -y

3.安裝常用軟件

常用軟件是指開發人員常用的如 jdk python 等開發工具。

3.1 JDK安裝

sudo su - root mkdir /opt/software cd /opt/software wget https://download.oracle.com/otn/java/jdk/8u231-b11/5b13a193868b4bf28bcb45c792fce896/jdk-8u231-linux-x64.rpm?AuthParam=1572433442_c80def4f441f1b246a14ed0417088aab mv ./jdk-8u231-linux-x64.rpm\?AuthParam\=1572433442_c80def4f441f1b246a14ed0417088aab ./jdk-8u231-linux-x64.rpm#開始安裝 rpm -ivh ./jdk-8u231-linux-x64.rpm

安裝過程

warning: ./jdk-8u231-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY Preparing... ################################# [100%] Updating / installing...1:jdk1.8-2000:1.8.0_231-fcs ################################# [100%] Unpacking JAR files...tools.jar...plugin.jar...javaws.jar...deploy.jar...rt.jar...jsse.jar...charsets.jar...localedata.jar...

按上述流程,依此完成3臺服務器的安裝。
分別是 192.168.162.201 192.168.162.202 192.168.162.203

4 安裝zookeeper

通常情況下,會建立一個zookeeper單獨運行用戶。

#一般根據服務器磁盤的掛載目錄,會將數據盤掛載到/opt 在root權限下運行如下命令,或者用sudo方式 useradd -d /opt/zookeeper zookeeper

將zookeeper 軟件下載到 /opt/software目錄。
需要注意的是,新版本3.5.6的zookeeper apache-zookeeper-3.5.6-bin.tar.gz 才是可以直接啟動的編譯后的文件,而apache-zookeeper-3.5.6.tar.gz則是源碼,可以自行用maven編譯。

#切換用戶 sudo su - zookeeper #解壓 tar -zxvf /opt/software/apache-zookeeper-3.5.6-bin.tar.gz /opt/zookeeper/ #建立軟鏈接,便于后續升級更換 ln -s /opt/zookeeper/apache-zookeeper-3.5.6-bin /opt/zookeeper/apache-zookeeper #新建 data logs 目錄,分別用于存放zookeeper的數據和日志mkdir /opt/zookeeper/data mkdir /opt/zookeeper/logs

目前有3臺服務器,zookeeper均執行上述操作,之后,zookeeper需要對各個節點分配id,通過一個myid的文件存儲在data目錄。
修改后的zoo.conf如下:

# The number of milliseconds of each tick 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=/opt/zookeeper/data # the port at which the clients will connect clientPort=2181 # the maximum number of client connections. # increase this if you need to handle more clients #maxClientCnxns=60 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1 server.1=192.168.162.201:2888:3888 server.2=192.168.162.202:2888:3888 server.3=192.168.162.203:2888:3888

dataDir路徑需要修改為指定目錄。
之后根據上述對應關系生成myid。

#在192.168.162.201服務器執行 echo '1' > /opt/zookeeper/data/myid #在192.168.162.202服務器執行 echo '2' > /opt/zookeeper/data/myid 在192.168.162.203服務器執行 echo '3'

另外為了讓zookeeper的日志能產生在指定的日志目錄,還需要將zkEnv.sh 文件進行修改:
將 將ZOO_LOG_DIR 修改為:

if [ "x${ZOO_LOG_DIR}" = "x" ] thenZOO_LOG_DIR="/opt/zookeeper/logs" fi

之后,分別在三臺服務器上啟動zookeeper

/opt/zookeeper/apache-zookeeper/bin/zkServer.sh start

5. 安裝storm

5.1 基礎準備

storm通過wget的方式,下載到/opt/software目錄,完整路徑為:/opt/software/apache-storm-1.2.3.tar.gz

#一般根據服務器磁盤的掛載目錄,會將數據盤掛載到/opt 在root權限下運行如下命令,或者用sudo方式 useradd -d /opt/storm storm sudo su - storm #解壓縮 tar -zxvf /opt/software/apache-storm-1.2.3.tar.gz ./ #建立軟鏈接 一定要用軟鏈接的方式,便于以后程序升級。 ln -s /opt/storm/apache-storm-1.2.3 /opt/storm/apache-storm

5.2 配置

storm有很多配置選項,默認的配置項可以參考git
https://github.com/apache/storm/blob/v1.2.3/conf/defaults.yaml
根據服務器信息,基本配置如下:

#storm本地存儲目錄 storm.local.dir: "/opt/storm/data" #zookeeper服務 storm.zookeeper.servers:- "192.168.162.201"- "192.168.162.202"- "192.168.162.203" #zookeeper端口,注意,不支持各節點用不同的端口,zk不要弄得太奇怪 storm.zookeeper.port: 2181 #nimbus的種子節點,這個地方要填host名稱,否則UI展示會有問題 nimbus.seeds : ["m162p201","m162p202","m162p203"] #UI的監聽IP及端口 ui.host: 0.0.0.0 ui.port: 8087 #如果有統一的日志采集工具,可以不用開logviewer logviewer.port: 8000 #supervisor 槽 supervisor.slots.ports:- 6700- 6701- 6702- 6703

因為上述配置中使用了各節點的hostname,因此需要在hosts中配置,都需要加上:

192.168.162.201 m162p201 192.168.162.202 m162p202 192.168.162.203 m162p203

環境變量配置:
修改.bash_profile 增加如下內容

STORM_HOME=/opt/storm/apache-storm PATH=$PATH:$STORM_HOME/bin export PATH

之后重新加載環境變量

source .bash_profile

5.3 啟動storm

sudo su - storm #啟動supervisor nohup storm supervisor > /dev/null 2>&1 & #啟動nimbus nohup storm supervisor > /dev/null 2>&1 & #啟動UI nohup storm ui > /dev/null 2>&1 &

UI只需要啟動一個節點即可,其他服務器都啟動nimbus和supervisor.
至此,storm集群已搭建完畢。

總結

以上是生活随笔為你收集整理的基于centos7 搭建storm1.2.3集群过程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。