在以往的文章中,我们已向你介绍了Docker(容器)的世界。这篇文章将引导你配置一个Alluxio集群。
第一步,使用依赖的软件包创建一个基本映像,并打开SSH端口(22)。同时,通过Alluxio 请求者(master)使用SSH连接处理者(workers)来创建Hadoop用户,以便启动进程。
下一步,使用以下必要步骤来创建一个Docker文件并安装Alluxio:
此外,创建具有集群信息(Master和Worke)的容器构成(Docker-Compose)文件。在我们给出的例子中,有一个请求者(master)和两个处理者(two workers)。
version: '2'
services:
#############################
# Master1
#############################
master1:
container_name: master1
domainname: master1.dev
hostname: master1
image: alluxio_base
working_dir: /opt/apache/
restart: always
ports:
- "32000:22"
- "32001:19999"
volumes:
- ./master1:/apacheapps/data/alluxio/master1
# - ./master1/conf:/opt/apache/alluxio/conf
# - ./master1/logs:/opt/apache/alluxio/logs:rw
mem_limit: 1000000000
#############################
# worker1
#############################
worker1:
container_name: worker1
domainname: worker1.dev
hostname: worker1
image: alluxio_base
working_dir: /opt/apache/
restart: always
ports:
- "32002:22"
- "32003:30000"
- "32004:19999"
volumes:
- ./worker1:/apacheapps/data/alluxio/worker1
# - ./worker1/conf:/opt/apache/alluxio/conf
# - ./worker1/logs:/opt/apache/alluxio/logs:rw
- ./worker1/ramdisk:/mnt/ramdisk
mem_limit: 1000000000
#############################
# worker2
#############################
worker2:
container_name: worker2
domainname: worker2.dev
hostname: worker2
image: alluxio_base
working_dir: /opt/apache/
restart: always
ports:
- "32005:22"
- "32006:30000"
- "32007:19999"
volumes:
- ./worker2:/apacheapps/data/alluxio/worker2
# - ./worker2/conf:/opt/apache/alluxio/conf
# - ./worker2/logs:/opt/apache/alluxio/logs:rw
- ./worker1/ramdisk:/mnt/ramdisk
mem_limit: 1000000000
接下来,使用“docker-compose up -d
”命令启动容器。连接到主容器后,使用超级用户指令连接到Hadoop(sudo su - hadoop
),生成SSH密钥(ssh-keygen)
,并将密钥(ssh-copy-id
)复制到处理者处理者wokers(/ opt / apache / alluxio / workers
)下。
最后一步,创建Alluxio运行所需的配置文件,并启动集群。
cd / opt / apache / alluxio / bin.
./alluxio bootstrapConf master1
./alluxio copyDir ../conf
./alluxio format
./alluxio-start.sh all NoMount
配置完成后,集群的截图如下: