基于centos7 搭建storm1.2.3集群过程
1.環境準備
申請3臺測試環境,IP地址如下:
192.168.162.201 m162p201 192.168.162.202 m162p202 192.168.162.203 m162p2031.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 包需要安裝
然后修改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是不帶的,需要自行安裝:
2.2 監控類軟件
監控類軟件 nmon atop htop iotop
yum -y install nmon atop htop iotop2.3 故障分析類軟件
故障分析類軟件 telnet mtr
yum -y install telnet mtr2.4 基礎類庫
安裝基礎類庫,glibc-headers openssl-devel bzip2-devel readline-devel sqlite-devel bison cmake
注意,CentOS會帶很多基礎包,但都不是devel版本,安裝devel版本是為了后續需要根據源碼編譯安裝軟件來試用,如根據源碼安裝mysql等,就需要很多基礎庫。
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編譯。
目前有3臺服務器,zookeeper均執行上述操作,之后,zookeeper需要對各個節點分配id,通過一個myid的文件存儲在data目錄。
修改后的zoo.conf如下:
dataDir路徑需要修改為指定目錄。
之后根據上述對應關系生成myid。
另外為了讓zookeeper的日志能產生在指定的日志目錄,還需要將zkEnv.sh 文件進行修改:
將 將ZOO_LOG_DIR 修改為:
之后,分別在三臺服務器上啟動zookeeper
/opt/zookeeper/apache-zookeeper/bin/zkServer.sh start5. 安裝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-storm5.2 配置
storm有很多配置選項,默認的配置項可以參考git
https://github.com/apache/storm/blob/v1.2.3/conf/defaults.yaml
根據服務器信息,基本配置如下:
因為上述配置中使用了各節點的hostname,因此需要在hosts中配置,都需要加上:
192.168.162.201 m162p201 192.168.162.202 m162p202 192.168.162.203 m162p203環境變量配置:
修改.bash_profile 增加如下內容
之后重新加載環境變量
source .bash_profile5.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集群过程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ecstore新增数据格式
- 下一篇: 大数据项目(一)————生成团购标签