一、环境配置
1.集群环境
主机名 IP 角色 Node1 192.168.1.1 TachyonMaster、TachyonWorker Node2 192.168.1.2 TachyonWorker Node3 192.168.1.3 TachyonWorker
2.每个节点上清空iptables规则
# service iptables save iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定] #
3.每个节点上关闭selinux
# cat /etc/sysconfig/selinux |grep SELINUX |grep -v ^# SELINUX=disabled SELINUXTYPE=targeted #
4.每个节点配置ip地址
# cat /etc/sysconfig/network-scripts/ifcfg-eth0 |grep IPADDR IPADDR=192.168.1.1 #
5.每个节点配置主机名
# cat /etc/sysconfig/network|grep HOSTNAME HOSTNAME=node1 #
6.每个节点配置hosts
# cat /etc/hosts 127.0.0.1 localhost 192.168.1.1 node1 192.168.1.2 node2 192.168.1.3 node3 #
7.每个节点进行时间同步
# ntpdate 192.168.1.254
8.每个节点上配置ssh免密码登录
[root@node1 桌面]# ssh-keygen -trsa -f ~/.ssh/id_rsa -P '' [root@node1 ~]# ssh-copy-id -i node1 [root@node1 ~]# ssh-copy-id -i node2 [root@node1 ~]# ssh-copy-id -i node3
二、安装java环境
1.每个节点下载并安装jdk
# rpm -ivh jdk-7-linux-x64.rpm
2.每个节点配置java环境
# cat /etc/profile.d/java.sh JAVA_HOME=/usr/java/default PATH=$JAVA_HOME/bin:$PATH # source /etc/profile.d/java.sh
3.每个节点上检测java环境
# java -version java version "1.7.0_09-icedtea" OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64) OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode) #
三、安装Tachyon
1.下在并安装Tachyon
# wgethttp://tachyon-project.org/downloads/tachyon-0.5.0-bin.tar.gz # tar -zxf tachyon-0.5.0-bin.tar.gz -C /usr/local/ # ln -s /usr/local/tachyon-0.5.0//usr/local/tachyon
2.配置Tachyon环境
# cat /etc/profile.d/tachyon.sh TACHYON_HOME=/usr/local/tachyon PATH=$TACHYON_HOME/bin:$PATH # source /etc/profile.d/tachyon.sh
3.复制配置文件
# pwd /usr/local/tachyon/conf # cp tachyon-env.sh.template tachyon-env.sh
4.修改tachyon-env.sh配置文件
# cat tachyon-env.sh |egrep 'JAVA_HOME|TACHYON_MASTER_ADDRESS|TACHYON_UNDERFS_ADDRESS|TACHYON_WORKER_MEMORY_SIZE'|grep-v ^#|grep -v ^' ' JAVA_HOME=/usr/java/default export JAVA="$JAVA_HOME/bin/java" export TACHYON_MASTER_ADDRESS=node1 exportTACHYON_UNDERFS_ADDRESS=$TACHYON_HOME/underfs export TACHYON_WORKER_MEMORY_SIZE=512MB #
5.配置slave节点
# pwd /usr/local/tachyon/conf # cat slaves |grep -v ^# node1 node2 node3 #
6.将配置复制到其它节点
[root@node1 ~]# scp -r/usr/local/tachyon-0.5.0/ node2:/usr/local/ [root@node1 ~]# scp -r/usr/local/tachyon-0.5.0/ node3:/usr/local/ [root@node1 ~]# ssh node2 ln -s/usr/local/tachyon-0.5.0/ /usr/local/tachyon [root@node1 ~]# ssh node3 ln -s/usr/local/tachyon-0.5.0/ /usr/local/tachyon [root@node1 ~]# scp/etc/profile.d/tachyon.sh node2:/etc/profile.d/ tachyon.sh 100% 61 0.1KB/s 00:00 [root@node1 ~]# scp/etc/profile.d/tachyon.sh node3:/etc/profile.d/ tachyon.sh 100% 61 0.1KB/s 00:00 [root@node1 ~]#
7.初始化tachyon
[root@node1 ~]# tachyon format Connection to node1... Formatting Tachyon Worker @ node1 Removing local data under folder: /mnt/ramdisk/tachyonworker/ Connection to node1 closed. Connection to node2... Formatting Tachyon Worker @ node2 Removing local data under folder: /mnt/ramdisk/tachyonworker/ Connection to node2 closed. Connection to node3... Formatting Tachyon Worker @ node3 Removing local data under folder: /mnt/ramdisk/tachyonworker/ Connection to node3 closed. Formatting Tachyon Master @ node1 Formatting JOURNAL_FOLDER: /usr/local/tachyon-0.5.0/libexec/../journal/ Formatting UNDERFS_DATA_FOLDER: /usr/local/tachyon-0.5.0/libexec/../underfs/tmp/tachyon/data Formatting UNDERFS_WORKERS_FOLDER: /usr/local/tachyon-0.5.0/libexec/../underfs/tmp/tachyon/workers [root@node1 ~]#
8.启动tachyon集群
[root@node1 ~]# tachyon-start.sh all Mount Killed 0 processes Killed 0 processes Connection to node1... Killed 0 processes Connection to node1 closed. Connection to node2... Killed 0 processes Connection to node2 closed. Connection to node3... Killed 0 processes Connection to node3 closed. Starting master @ node1 Connection to node1... Formatting RamFS:/mnt/ramdisk (512mb) Starting worker @ node1 Connection to node1 closed. Connection to node2... Formatting RamFS:/mnt/ramdisk (512mb) Starting worker @ node2 Connection to node2 closed. Connection to node3... Formatting RamFS:/mnt/ramdisk (512mb) Starting worker @ node3 Connection to node3 closed. [root@node1 ~]#
9.每个节点上查看tachyon进程
[root@node1 ~]# jps 3647 Jps 3369 TachyonMaster 3501 TachyonWorker [root@node1 ~]# ssh node2 jps 3403 TachyonWorker 3434 Jps [root@node1 ~]# ssh node3 jps 3440 Jps 3410 TachyonWorker [root@node1 ~]#
10.测试tachyon集群
[root@node1 ~]# tachyon runTest BasicCACHE_THROUGH /BasicFile_CACHE_THROUGH has been removed 2014-10-08 14:41:53,932 INFO (TachyonFS.java:connect) - Trying to connectmaster @ node1/192.168.1.1:19998 2014-10-08 14:41:54,002 INFO (MasterClient.java:getUserId) - Userregistered at the master node1/192.168.1.1:19998 got UserId 2 2014-10-08 14:41:54,003 INFO (TachyonFS.java:connect) - Trying to getlocal worker host : node1 2014-10-08 14:41:54,023 INFO (TachyonFS.java:connect) - Connecting localworker @ node1/192.168.1.1:29998 2014-10-08 14:41:54,093 INFO (CommonUtils.java:printTimeTakenMs) -createFile with fileId 2 took 162 ms. 2014-10-08 14:41:54,195 INFO (TachyonFS.java:createAndGetUserTempFolder)- Folder /mnt/ramdisk/tachyonworker/users/2 was created! 2014-10-08 14:41:54,200 INFO (BlockOutStream.java:<init>) -/mnt/ramdisk/tachyonworker/users/2/2147483648 was created! Passed the test! [root@node1 ~]#
11.查看tachyon WEB UI