下载文件:wget https://downloads.alluxio.io/downloads/files/2.8.0/alluxio-2.8.0-bin.tar.gz
解压目录:/opt/servers/alluxio
创建目录:mkdir -p /mnt/ramdisk
机器:192.168.3.21(master,worker)192.168.3.22(master,worker)192.168.0.198(worker)
创建目录:/dev/ramdisk
# 创建虚拟盘
modprobe brd rd_nr=1 rd_size=16777216 max_part=0
modprobe brd rd_nr=1 rd_size=5120000 max_part=0
# 格式化虚拟磁盘
mkfs.ext4 /dev/ram0
mke2fs /dev/ram0
mkfs -t ext2 /dev/ram0
# 挂载虚拟磁盘
mount /dev/ram0 /mnt/ramdisk0
# 写入测试
dd if=/dev/zero of=/mnt/ramdisk/lala2.im bs=8k count=500000 conv=fsync
# 读取测试
dd if=/mnt/ramdisk0//lala.im of=/dev/null bs=8
# 卸载虚拟磁盘
fuser -m /dev/ram0/
ps aux | grep 9236
kill -9 10167
umount /dev/ram0
搭建高可用集群前的准备:
①确保Zookeeper服务已经运行
②一个单独安装的可靠的共享日志存储系统(可用HDFS或S3等系统)
③这个配置针对Alluxio 2.x版本,不适用于1.x版本
④需要事先创建好ramdisk挂载目录
配置hive alluxio文件系统:core-site.xml
<configuration>
<property>
<name>fs.alluxio.impl</name>
<value>alluxio.hadoop.FileSystem</value>
<description>The Alluxio FileSystem (Hadoop 1.x and 2.x)</description>
</property>
<property>
<name>fs.AbstractFileSystem.alluxio.impl</name>
<value>alluxio.hadoop.AlluxioFileSystem</value>
<description>The Alluxio AbstractFileSystem (Hadoop 2.x)</description>
</property>
</configuration>
在所有机器上配置alluxio-env.sh (/usr/java/jdk1.8.0_291)
ALLUXIO_HOME=/opt/servers/alluxio
ALLUXIO_LOGS_DIR=/opt/servers/alluxio/logs
ALLUXIO_RAM_FOLDER=/mnt/ramdisk
JAVA_HOME=/usr/java/jdk1.8.0_291
ALLUXIO_WORKER_JAVA_OPTS=" -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:+PrintGCTimeStamps"
ALLUXIO_MASTER_JAVA_OPTS=" -Xms2048M -Xmx4096M"
ALLUXIO_JAVA_OPTS+=" -Djava.library.path=/opt/cloudera/parcels/CDH/lib/hadoop"
在3.21机器上配置Master和Worker:alluxio-site.properties
# 192.168.3.21 Master Worker
# Common properties
alluxio.master.hostname=192.168.3.21
alluxio.underfs.hdfs.configuration=/etc/hadoop/conf/core-site.xml:/etc/hadoop/conf/hdfs-site.xml
alluxio.master.mount.table.root.ufs=hdfs://nameservice1/user/alluxio/ha/
# Worker properties
alluxio.worker.memory.size=512MB
alluxio.worker.tieredstore.levels=1
alluxio.worker.tieredstore.level0.alias=MEM
alluxio.worker.tieredstore.level0.dirs.path=/mnt/ramdisk
# HA properties
alluxio.zookeeper.enabled=true
alluxio.zookeeper.address=192.168.0.201:2181,192.168.3.21:2181,192.168.3.22:2181
alluxio.master.journal.type=UFS
alluxio.master.journal.folder=hdfs://nameservice1/user/alluxio/journal/
alluxio.worker.block.heartbeat.timeout.ms=300000
alluxio.zookeeper.session.timeout=120s
# User properties
alluxio.user.file.readtype.default=CACHE_PROMOTE
alluxio.user.file.writetype.default=ASYNC_THROUGH
alluxio.user.metrics.collection.enable=true
alluxio.master.metrics.time.series.interval=1000
# Security properties
alluxio.security.authorization.permission.enabled=true
alluxio.security.authentication.type=SIMPLE
alluxio.master.security.impersonation.hive.users=*
alluxio.master.security.impersonation.hive.groups=*
alluxio.master.security.impersonation.yarn.users=*
alluxio.master.security.impersonation.yarn.groups=*
alluxio.master.security.impersonation.hdfs.users=*
alluxio.master.security.impersonation.hdfs.groups=*
在3.22机器上配置Master和Worker:alluxio-site.properties
# 192.168.1.102 Master Worker
# Common properties
alluxio.master.hostname=192.168.3.22
alluxio.underfs.hdfs.configuration=/etc/hadoop/conf/core-site.xml:/etc/hadoop/conf/hdfs-site.xml
alluxio.master.mount.table.root.ufs=hdfs://nameservice1/user/alluxio/ha/
# Worker properties
alluxio.worker.memory.size=512MB
alluxio.worker.tieredstore.levels=1
alluxio.worker.tieredstore.level0.alias=MEM
alluxio.worker.tieredstore.level0.dirs.path=/mnt/ramdisk
# HA properties
alluxio.zookeeper.enabled=true
alluxio.zookeeper.address=192.168.0.201:2181,192.168.3.21:2181,192.168.3.22:2181
alluxio.master.journal.type=UFS
alluxio.master.journal.folder=hdfs://nameservice1/user/alluxio/journal/
alluxio.worker.block.heartbeat.timeout.ms=300000
alluxio.zookeeper.session.timeout=120s
# User properties
alluxio.user.file.readtype.default=CACHE_PROMOTE
alluxio.user.file.writetype.default=ASYNC_THROUGH
alluxio.user.metrics.collection.enable=true
alluxio.master.metrics.time.series.interval=1000
# Security properties
alluxio.security.authorization.permission.enabled=true
alluxio.security.authentication.type=SIMPLE
alluxio.master.security.impersonation.hive.users=*
alluxio.master.security.impersonation.hive.groups=*
alluxio.master.security.impersonation.yarn.users=*
alluxio.master.security.impersonation.yarn.groups=*
alluxio.master.security.impersonation.hdfs.users=*
alluxio.master.security.impersonation.hdfs.groups=*
在0.198机器上配置Master和Worker:alluxio-site.properties
# 192.168.0.198 Worker
# Common properties
# Worker不需要写alluxio.master.hostname参数和alluxio.master.journal.folder参数
alluxio.underfs.hdfs.configuration=/etc/hadoop/conf/core-site.xml:/etc/hadoop/conf/hdfs-site.xml
alluxio.master.mount.table.root.ufs=hdfs://nameservice1/user/alluxio/ha/
# Worker properties
alluxio.worker.memory.size=512MB
alluxio.worker.tieredstore.levels=1
alluxio.worker.tieredstore.level0.alias=MEM
alluxio.worker.tieredstore.level0.dirs.path=/mnt/ramdisk
# HA properties
alluxio.zookeeper.enabled=true
alluxio.zookeeper.address=192.168.0.201:2181,192.168.3.21:2181,192.168.3.22:2181
alluxio.worker.block.heartbeat.timeout.ms=300000
alluxio.zookeeper.session.timeout=120s
# User properties
alluxio.user.file.readtype.default=CACHE_PROMOTE
alluxio.user.file.writetype.default=ASYNC_THROUGH
alluxio.user.metrics.collection.enable=true
alluxio.master.metrics.time.series.interval=1000
# Security properties
alluxio.security.authorization.permission.enabled=true
alluxio.security.authentication.type=SIMPLE
alluxio.master.security.impersonation.hive.users=*
alluxio.master.security.impersonation.hive.groups=*
alluxio.master.security.impersonation.yarn.users=*
alluxio.master.security.impersonation.yarn.groups=*
alluxio.master.security.impersonation.hdfs.users=*
alluxio.master.security.impersonation.hdfs.groups=*
在所有机器上指定Master和Worker节点
#vim masters
192.168.3.21
192.168.3.22
#vim workers
192.168.3.21
192.168.3.22
192.168.0.198
测试部署是否成功
./alluxio format
./alluxio-start.sh all SudoMount
./alluxio fsadmin report
./alluxio runTests # 如果出现Passed the test则说明部署成功
测试高可用模式的自动故障处理: (假设此时hadoop101位primary master)
ssh hadoop101
jps | grep AlluxioMaster
kill -9 <AlluxioMaster PID>
alluxio fs leader # 显示新的primary Master(可能需要等待一小段时间选举)