主要分成两部分,yarn的安装与flink的安装, 共3台机器
10.10.10.125
10.10.10.126
10.10.10.127
—————————————————-yarn 安装
wget 'http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.8.5/hadoop-2.8.5.tar.gz'
tar -zxvf hadoop-2.8.5.tar.gz -C /home/zr/hadoop/
vim /etc/profile
export HADOOP_HOME=/home/zr/hadoop/hadoop-2.8.5
export PATH=$HADOOP_HOME/bin:$PATH
source /etc/profile
vim /etc/sysconfig/network host名千万不要搞成下划线 否则就等着完蛋吧
HOSTNAME=flink125(不同的机器配置不同)
vim /etc/hosts
10.10.10.125 flink125
10.10.10.126 flink126
10.10.10.127 flink127
vim yarn-site.xml 增加以下内容
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>flink125</value>
</property>
<property>
<name>yarn.resourcemanager.am.max-attempts</name>
<value>4</value>
<description>The maximum number of application master execution attempts</description>
</property>
<property>
<name>yarn.nodemanager.vmem-check-enabled</name>
<value>false</value>
</property>
vi etc/hadoop/core-site.xml 增加以下内容
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://flink125:9000</value>
</property>
</configuration>
vi etc/hadoop/hdfs-site.xml 增加以下内容
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///data/hadoop/storage/hdfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///data/hadoop/storage/hdfs/data</value>
</property>
$ vi etc/hadoop/mapred-site.xml 增加以下内容
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
vi slaves 增加以下内容
flink126
flink127
vim hadoop/etc/hadoop/hdoop-env.sh
将语句 export JAVA_HOME=$JAVA_HOME
修改为 export JAVA_HOME=/usr/java/jdk1.8.0_101
以上操作都是在三台机器上执行
下面是免登操作
1 在125机器上执行
rm -r ~/.ssh
ssh-keygen
scp ~/.ssh/id_rsa.pub 126,127 机器上
2 在126 127上分别执行
cat id_rsa.pub>>.ssh/authorized_keys
最后在125上执行以下操作
启动hadoop
start-dfs.sh
启动yarn
start-yarn.sh
—————————————————-yarn 配置完毕
——————————————————flink 安装
wget 'http://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.7.2/flink-1.7.2-bin-hadoop28-scala_2.12.tgz'
tar zxvf flink-1.7.2-bin-hadoop28-scala_2.12.tgz -C /home/zr/module/
修改flink/conf/masters,slaves,flink-conf.yaml
vi masters
flink125:8081
flink126:8081
vi slaves
flink126
flink127
vi flink-conf.yaml
taskmanager.numberOfTaskSlots:2
jobmanager.rpc.address: flink125
sudo vi /etc/profile
export FLINK_HOME=/opt/module/flink-1.6.1
export PATH=$PATH:$FLINK_HOME/bin
source /etc/profile
conf/flink-conf.yaml
high-availability: zookeeper
high-availability.zookeeper.quorum: flink125:2181,flink126:2181,flink127:2181
high-availability.storageDir: hdfs:///home/zr/flink/recovery
high-availability.zookeeper.path.root: /home/zr/flink
yarn.application-attempts: 4
zoo.cfg
server.1=flink125:2888:3888
server.2=flink126:2888:3888
server.3=flink127:2888:3888
以上操作都在三台机器上执行
——————————————–flink 配置完毕
在125机器上执行:
启动ZooKeeper仲裁
./start-zookeeper-quorum.sh
启动flink
./flink run -m yarn-cluster -yn 2 -ytm 2048 /home/zr/module/flink-1.7.2/examples/zr/flink-data-sync-0.1.jar
参考文章
https://www.cnblogs.com/frankdeng/p/9400627.html
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/193202.html