组件 | 版本 |
---|---|
jdk | 1.8 |
hadoop | 3.1.3 |
hive | 3.1.2 |
Hbase | 2.2.3 |
Kafka | 2.4.1 |
redis | 6.2.6 |
flume | 1.9.0 |
maxwell | 1.29.0 |
flink | 1.14.0 |
clickhouse | 21.9.4 |
mysql | 5.7 |
[root@master ~]#
tar -xzvf /chinaskills/hadoop-3.1.3.tar.gz -C /usr/local/src/
mv /usr/local/src/hadoop-3.1.3 /usr/local/src/hadoop
[root@master ~]#
vim /root/.bash_profile
配置内容:
export HADOOP_HOME=/usr/local/src/hadoop
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
加载环境变量
source /root/.bash_profile
[root@master ~]#
vim $HADOOP_HOME/etc/hadoop/hadoop-env.sh
配置内容:
export JAVA_HOME=/usr/local/src/java
[root@master ~]#
vim $HADOOP_HOME/etc/hadoop/core-site.xml
配置内容:
<property>
<name>fs.defaultFSname>
<value>hdfs://master:8020value>
property>
<property>
<name>hadoop.tmp.dirname>
<value>/usr/local/src/hadoop/dfs/tmpvalue>
property>
<property>
<name>io.file.buffer.sizename>
<value>131072value>
property>
<property>
<name>hadoop.proxyuser.root.hostsname>
<value>*value>
property>
<property>
<name>hadoop.proxyuser.root.groupsname>
<value>*value>
property>
<property>
<name>hadoop.proxyuser.root.usersname>
<value>*value>
property>
[root@master ~]#
vim $HADOOP_HOME/etc/hadoop/hdfs-site.xml
配置内容:
<property>
<name>dfs.namenode.name.dirname>
<value>/usr/local/src/hadoop/dfs/namevalue>
property>
<property>
<name>dfs.blocksizename>
<value>268435456value>
property>
<property>
<name>dfs.namenode.handler.countname>
<value>100value>
property>
<property>
<name>dfs.datanode.data.dirname>
<value>/usr/local/src/hadoop/dfs/datavalue>
property>
[root@master ~]#
vim $HADOOP_HOME/etc/hadoop/yarn-site.xml
配置内容:
<property>
<name>yarn.resourcemanager.hostnamename>
<value>mastervalue>
property>
<property>
<name>yarn.nodemanager.aux-servicesname>
<value>mapreduce_shufflevalue>
property>
<property>
<name>yarn.scheduler.minimum-allocation-mbname>
<value>1024value>
property>
<property>
<name>yarn.scheduler.maximum-allocation-mbname>
<value>4096value>
property>
<property>
<name>yarn.nodemanager.pmem-check-enabledname>
<value>falsevalue>
property>
<property>
<name>yarn.nodemanager.vmem-check-enabled name>
<value>falsevalue>
property>
<property>
<name>yarn.nodemanager.resource.cpu-vcoresname>
<value>5value>
property>
[root@master ~]#
vim $HADOOP_HOME/etc/hadoop/mapred-site.xml
配置内容:
<property>
<name>mapreduce.framework.namename>
<value>yarnvalue>
property>
<property>
<name>yarn.app.mapreduce.am.envname>
<value>HADOOP_MAPRED_HOME=/usr/local/src/hadoopvalue>
property>
<property>
<name>mapreduce.map.envname>
<value>HADOOP_MAPRED_HOME=/usr/local/src/hadoopvalue>
property>
<property>
<name>mapreduce.reduce.envname>
<value>HADOOP_MAPRED_HOME=/usr/local/src/hadoopvalue>
property>
<property>
<name>mapreduce.map.memory.mbname>
<value>2048value>
property>
<property>
<mame>mapreduce.map.java.optsmame>
<value>-Xmx1536Mvalue>
property>
<property>
<name>mapreduce.reduce.memory.mbname>
<value>4096value>
property>
<property>
<mame>mapreduce.map.java.optsmame>
<value>-Xmx2560Mvalue>
property>
<property>
<name>mapreduce.jobhistory.addressname>
<value>master:10020value>
property>
<property>
<name>mapreduce.jobhistory.webapp.addressname>
<value>master:19888value>
property>
<property>
<name>mapreduce.jobhistory.intermediate-done-dirname>
<value>/mr-history/tmpvalue>
property>
<property>
<name>mapreduce.jobhistory.done-dirname>
<value>/mr-history/donevalue>
property>
[root@master ~]#
vim $HADOOP_HOME/etc/hadoop/workers
配置内容:
master
slave1
slave2
[root@master ~]#
vim $HADOOP_HOME/sbin/start-dfs.sh
配置内容:
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
vim $HADOOP_HOME/sbin/start-yarn.sh
配置内容:
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
[root@master ~]#
vim $HADOOP_HOME/sbin/stop-dfs.sh
配置内容:
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
vim $HADOOP_HOME/sbin/stop-yarn.sh
配置内容:
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
[root@master ~]#
scp -r /usr/local/src/hadoop root@slave1:/usr/local/src/
scp -r /usr/local/src/hadoop root@slave2:/usr/local/src/
scp /root/.bash_profile root@slave1:/root/
scp /root/.bash_profile root@slave2:/root/
[root@master ~]#
hdfs namenode -format
[root@master ~]#
start-all.sh
[root@master ~]#
jps
yarn jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar pi 10 10
[root@master ~]#
tar -xzvf /chinaskills/apache-hive-3.1.2-bin.tar.gz -C /usr/local/src/
mv /usr/local/src/apache-hive-3.1.2-bin /usr/local/src/hive
[root@master ~]#
vim /root/.bash_profile
配置内容
export HIVE_HOME=/usr/local/src/hive
export PATH=$PATH:$HIVE_HOME/bin
加载环境变量
source /root/.bash_profile
[root@master ~]#
cp /usr/local/src/hive/conf/hive-default.xml.template /usr/local/src/hive/conf/hive-site.xml
vim /usr/local/src/hive/conf/hive-site.xml
配置内容:
<property>
<name>javax.jdo.option.ConnectionURLname>
<value>jdbc:mysql://master:3306/hive?createDatabaseIfNotExist=true&useSSL=falsevalue>
property>
<property>
<name>javax.jdo.option.ConnectionDriverNamename>
<value>com.mysql.jdbc.Drivervalue>
property>
<property>
<name>javax.jdo.option.ConnectionUserNamename>
<value>rootvalue>
property>
<property>
<name>javax.jdo.option.ConnectionPasswordname>
<value>123456value>
property>
<property>
<name>hive.metastore.warehouse.dirname>
<value>/user/hive/warehousevalue>
property>
<property>
<name>hive.metastore.urisname>
<value>thrift://master:9083value>
property>
<property>
<name>hive.cli.print.headername>
<value>truevalue>
property>
<property>
<name>hive.cli.print.current.dbname>
<value>truevalue>
property>
<property>
<name>hive.server2.thrift.bind.hostname>
<value>mastervalue>
property>
<property>
<name>hive.server2.thrift.portname>
<value>10000value>
property>
<property>
<name>hive.server2.thrift.min.worker.threadsname>
<value>5value>
property>
<property>
<name>hive.server2.thrift.max.worker.threadsname>
<value>500value>
property>
<property>
<name>hive.metastore.urisname>
<value>thrift://master:9083value>
property>
<property>
<name>hive.exec.scratchdirname>
<value>/tmp/hiveinfovalue>
property>
[root@master ~]#
cp /chinaskills/mysql-connector-java-5.1.47.jar /usr/local/src/hive/lib/
[root@master ~]#
rm -rf /usr/local/src/hive/lib/guava-19.0.jar
cp /usr/local/src/hadoop/share/hadoop/common/lib/guava-27.0-jre.jar /usr/local/src/hive/lib/
[root@master ~]#
schematool -dbType mysql -initSchema
[root@master ~]#
nohup hive --service metastore > metastore.log 2>&1 &
nohup hive --service hiveserver2 > H2S.log 2>&1 &
[root@master ~]#
tar -xzvf /chinaskills/apache-zookeeper-3.7.1-bin.tar.gz -C /usr/local/src/
mv /usr/local/src/apache-zookeeper-3.7.1-bin /usr/local/src/zookeeper
[root@master ~]#
vim /root/.bash_profile
配置内容:
export ZOOKEEPER_HOME=/usr/local/src/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin
[root@master ~]#
cp /usr/local/src/zookeeper/conf/zoo_sample.cfg /usr/local/src/zookeeper/conf/zoo.cfg
vim /usr/local/src/zookeeper/conf/zoo.cfg
配置内容:
dataDir=/usr/local/src/zookeeper/data
dataLogDir=/usr/local/src/zookeeper/logs
server.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888
[root@master ~]#
mkdir /usr/local/src/zookeeper/{data,logs}
echo "1" > /usr/local/src/zookeeper/data/myid
source /root/.bash_profile
scp -r /usr/local/src/zookeeper slave1:/usr/local/src/
scp -r /usr/local/src/zookeeper slave2:/usr/local/src/
scp /root/.bash_profile slave1:/root/
scp /root/.bash_profile slave2:/root/
[root@slave1 ~]#
echo 2 > /usr/local/src/zookeeper/data/myid
source /root/.bash_profile
[root@slave2 ~]#
echo 3 > /usr/local/src/zookeeper/data/myid
source /root/.bash_profile
[root@master ~]#
zkServer.sh start
[root@slave1 ~]#
zkServer.sh start
[root@slave2 ~]#
zkServer.sh start
[root@master ~]#
tar -xzvf /chinaskills/hbase-2.2.3-bin.tar.gz -C /usr/local/src/
mv /usr/local/src/hbase-2.2.3 /usr/local/src/hbase
[root@master ~]#
vim /root/.bash_profile
配置内容
export HBASE_HOME=/usr/local/src/hbase
export PATH=$PATH:$HBASE_HOME/bin
加载环境变量:
source /root/.bash_profile
[root@master ~]#
vim /usr/local/src/hbase/conf/hbase-env.sh
配置内容:
# 配置jdk文件路径
export JAVA_HOME=/usr/local/src/java
# 是否使用hbase的zk服务
export HBASE_MANAGES_ZK=false
[root@master ~]#
vim /usr/local/src/hbase/conf/hbase-site.xml
配置内容:
<property>
<name>hbase.rootdirname>
<value>hdfs://master:8020/hbasevalue>
property>
<property>
<name>hbase.tmp.dirname>
<value>/usr/local/src/hbase/tmpvalue>
property>
<property>
<name>hbase.cluster.distributedname>
<value>truevalue>
property>
<property>
<name>hbase.zookeeper.quorumname>
<value>master,slave1,slave2value>
property>
<property>
<name>hbase.zookeeper.property.dataDirname>
<value>/usr/local/src/zookeeper/datavalue>
property>
[root@master ~]#
vim /usr/local/src/hbase/conf/regionservers
配置内容:
slave1
slave2
[root@master ~]#
scp -r /usr/local/src/hbase root@slave1:/usr/local/src/
scp -r /usr/local/src/hbase root@slave2:/usr/local/src/
scp /root/.bash_profile root@slave1:/root/
scp /root/.bash_profile root@slave2:/root/
[root@master ~]#
start-hbase.sh
stop-hbase.sh
[root@master ~]#
tar -xzvf /chinaskills/redis-6.2.6.tar.gz -C /usr/local/src/
[root@master ~]#
yum install -y centos-release-scl yum-plugin-downloadonly devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils --downloadonly --downloaddir=redis_dependencies
[root@master ~]#
cd /usr/local/src/redis-6.2.6
[root@master redis-6.2.6]#
make
make install
[root@master ~]#
vim /usr/local/src/redis-6.2.6/redis.conf
配置内容:
# 配置允许访问地址
bind 0.0.0.0 -::1
# 开启后台运行
daemonize yes
[root@master ~]#
redis-server /usr/local/src/redis-6.2.6/redis.conf
[root@master ~]#
redis-cli --raw
[root@master ~]#
tar -xzvf /chinaskills/clickhouse-common-static-21.1.9.41.tgz -C /usr/local/src/
mv /usr/local/src/clickhouse-common-static-21.1.9.41 /usr/local/src/clickhouse-common-static
[root@master ~]#
/usr/local/src/clickhouse-common-static/install/doinst.sh
[root@master ~]#
tar -xzvf /chinaskills/clickhouse-server-21.1.9.41.tgz -C /usr/local/src/
mv /usr/local/src/clickhouse-server-21.1.9.41 /usr/local/src/clickhouse-server
[root@master ~]#
/usr/local/src/clickhouse-server/install/doinst.sh
[root@master ~]#
systemctl start clickhouse-server.service
[root@master ~]#
systemctl status clickhouse-server.service
[root@master ~]#
tar -xzvf /chinaskills/clickhouse-client-21.1.9.41.tgz -C /usr/local/src/
mv /usr/local/src/clickhouse-client-21.1.9.41 /usr/local/src/clickhouse-client
[root@master ~]#
/usr/local/src/clickhouse-client/install/doinst.sh
[root@master ~]#
clickhouse-client
[root@master ~]#
systemctl stop clickhouse-server.service
[root@master ~]#
tar -xzvf /chinaskills/flink-1.14.0-bin-scala_2.12.tgz -C /usr/local/src/
mv /usr/local/src/flink-1.14.0 /usr/local/src/flink
[root@master ~]#
vim /root/.bash_profile
配置内容:
export FLINK_HOME=/usr/local/src/flink
export PATH=$PATH:$FLINK_HOME/bin
加载环境变量
source /root/.bash_profile
[root@master ~]#
start-cluster.sh
[root@master ~]#
flink run $FLINK_HOME/examples/batch/WordCount.jar
[root@master ~]#
stop-cluster.sh
延续上述步骤
[root@master ~]#
vim /usr/local/src/flink/conf/masters
配置内容:
master:8081
[root@master ~]#
vim /usr/local/src/flink/conf/workers
配置内容:
slave1
slave2
[root@master ~]#
vim /usr/local/src/flink/conf/flink-conf.yaml
配置内容:
# 设置jobmanager
jobmanager.rpc.address: master
[root@master ~]#
vim /usr/local/src/flink/conf/log4j.properties
配置内容:
rootLogger.level = DEBUG
[root@master ~]#
scp -r /usr/local/src/flink root@slave1:/usr/local/src
scp -r /usr/local/src/flink root@slave2:/usr/local/src
scp /root/.bash_profile root@slave1:/root
scp /root/.bash_profile root@slave2:/root
[root@master ~]#
start-cluster.sh
[root@master ~]#
stop-cluster.sh
延用上述配置
[root@master ~]#
vim /root/.bash_profile
配置内容:
export HADOOP_CLASSPATH=$(/usr/local/src/hadoop/bin/hadoop classpath)
export HADOOP_CONF_DIR=${HADOOP_HOME}/etc/Hadoop
加载环境变量
source /root/.bash_profile
[root@master ~]#
yarn-session.sh -n 1 -jm 2048 -tm 4096 -d
[root@master ~]#
flink run $FLINK_HOME/examples/batch/WordCount.jar
运行结果:
[root@master ~]#
flink list
echo "stop" | yarn-session.sh -id application_1665642382955_0004
[root@master ~]#
flink run -t yarn-per-job $FLINK_HOME/examples/batch/WordCount.jar
报错警告
Exception in thread "Thread-5" java.lang.IllegalStateException: Trying to access closed classloader. Please check if you store classloaders directly or indirectly in static fields. If the stacktrace suggests that the leak occurs in a third party library and cannot be fixed immediately, you can disable this check with the configuration 'classloader.check-leaked-classloader'.
解决措施配置flink-conf.yaml
vim /usr/local/src/flink/conf/flink-conf.yaml
修改配置内容:
classloader.check-leaked-classloader: false
[root@master ~]#
tar -xzvf /chinaskills/spark-3.1.1-bin-hadoop3.2.tgz -C /usr/local/src/
mv /usr/local/src/spark-3.1.1-bin-hadoop3.2 /usr/local/src/spark
[root@master ~]#
vim /root/.bash_profile
配置内容
export SPARK_HOME=/usr/local/src/spark
export PATH=$PATHL:$SPARK_HOME/bin
加载环境变量
source /root/.bash_profile
[root@master ~]#
cp /usr/local/src/spark/conf/spark-env.sh.template /usr/local/src/spark/conf/spark-env.sh
vim /usr/local/src/spark/conf/spark-env.sh
配置内容:
# java位置
export JAVA_HOME=/usr/local/src/java
# master节点IP或域名
export SPARK_MASTER_IP=master
# worker内存大小
export SPARK_WORKER_MEMORY=2G
# Worker的cpu核数
export SPARK_WORKER_CORES=2
export SCALA_HOME=/usr/local/scala
export SPARK_LOCAL_DIRS=/usr/local/src/spark
# hadoop配置文件路径
export HADOOP_CONF_DIR=/usr/local/src/hadoop/etc/hadoop
[root@master ~]#
spark-submit --master yarn --class org.apache.spark.examples.SparkPi /usr/local/src/spark/examples/jars/spark-examples_2.12-3.1.1.jar