配置Alluxio
1-1)、修改配置文件
在${ALLUXIO_HOME}/conf目录下,根据模板文件创建conf/alluxio-env.sh配置文件
cp conf/alluxio-site.properties.template conf/alluxio-site.properties
在conf/alluxio-site.properties文件中将 alluxio.master.hostname更新为你打算运行Alluxio Master的机器主机名
验证Alluxio运行环境
1-1)、当前系统环境下Alluxio可以正常运行
# alluxio validateEnv local
详细日志:http://blog.csdn.net/xfg0218/article/details/79414417
启动Alluxio
1-1)、格式化Alluxio为启动Alluxio做准备
# ./alluxio format
*******
2018-02-28 23:26:23,558 INFO UfsJournal - Formatting /home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/journal/BlockMaster/v1
2018-02-28 23:26:23,643 INFO UfsJournal - Formatting /home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/journal/FileSystemMaster/v1
2018-02-28 23:26:23,691 INFO Format - Formatting complete
详细日志请查看:http://blog.csdn.net/xfg0218/article/details/79411041
1-2)、我们启动Alluxio!Alluxio默认配置成在localhost启动master和worker。我们可以用如下命令在localhost启动Alluxio
#./alluxio-start.sh local
Killed 0 processes on alpha-cn-01
Killed 0 processes on alpha-cn-01
Killed 0 processes on alpha-cn-01
Killed 0 processes on alpha-cn-01
Starting master @ alpha-cn-01.cars.com. Logging to /home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/logs
Starting secondary master @ alpha-cn-01.cars.com. Logging to /home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/logs
Formatting RamFS: /mnt/ramdisk (11036104021)
Starting worker @ alpha-cn-01.cars.com. Logging to /home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/logs
Starting proxy @ alpha-cn-01.cars.com. Logging to /home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/logs
1-3)、使用Alluxio Shell
查看alluxio的运行情况
A)、查看运行的状态
# ps -ef|grep alluxio
*******************
root 146389 1 49 23:26 pts/1 00:00:08 /opt/jdk1.8.0_131/bin/java -cp /home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/conf/::/home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/assembly/server/target/alluxio-assembly-server-1.7.0-jar-with-dependencies.jar -Dalluxio.home=/home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7 -Dalluxio.conf.dir=/home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/conf -Dalluxio.logs.dir=/home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/logs -Dlog4j.configuration=file:/home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/conf/log4j.properties -Dorg.apache.jasper.compiler.disablejsr199=true -Djava.net.preferIPv4Stack=true -Dalluxio.logger.type=PROXY_LOGGER alluxio.proxy.AlluxioProxy
root 146549 108303 0 23:27 pts/1 00:00:00 grep --color=auto alluxio
B)、查看运行的端口
# netstat -nltp|grep 19999
tcp 0 0 0.0.0.0:19999 0.0.0.0:* LISTEN 146127/java
查看alluxio的命令详解
A)、查看帮助
# ./alluxio fs
Usage: alluxio fs [generic options]
[cat
]
*********
详细请查看:http://blog.csdn.net/xfg0218/article/details/79411127
B)、命令详解
1-1)、查看目录下的文件
#alluxio fs ls /
1-2)、复制文件到alluxio平台上
# alluxio fs copyFromLocal LICENSE /LICENSE
Copied file:///home/xiaoxu/installSoftware/alluxio-1.7.0-hadoop-2.7/LICENSE to /LICENSE
1-3)、查看alluxio平台上的文件
# alluxio fs ls /
-rw-r--r-- root root 26847 NOT_PERSISTED 02-28-2018 23:33:35:486 100% /LICENSE
1-4)、创建目录
# alluxio fs mkdir /xiaoxu
Successfully created directory /xiaoxu
1-5)、迭代查看文件夹下的文件
# alluxio fs ls -R /
-rw-r--r-- root root 26847 PERSISTED 02-28-2018 23:33:35:486 100% /LICENSE
drwxr-xr-x root root 1 NOT_PERSISTED 03-01-2018 02:42:31:011 DIR /xiaoxu
-rw-r--r-- root root 3893 NOT_PERSISTED 03-01-2018 02:44:02:356 100% /xiaoxu/alluxio_test.log
1-6)、查找alluxio_test.log文件中有多少个1234567
# time alluxio fs cat /xiaoxu/alluxio_test.log |grep -c 1234567
123
real 0m5.315s
user 0m6.240s
sys 0m3.854s
1-7)、把数据加载到内存中
# time alluxio fs load /xiaoxu/alluxio_test.log
1-8)、重新执行语句查看耗时
#time alluxio fs cat /xiaoxu/alluxio_test.log |grep -c 1234567
123
real 0m1.315s
user 0m6.240s
sys 0m3.854s
1-9)、关闭Alluxio
#alluxio-stop.sh local
1-4)、alluxio 映射Hive
参考资料:https://www.alluxio.org/docs/master/cn/Running-Hive-with-Alluxio.html
A)、下载文件
https://grouplens.org/datasets/movielens/ 处下载ml-100k.zip
B)、创建目录
、# alluxio fs mkdir /ml-100k
Successfully created directory /ml-100k
C)、上传文件
# alluxio fs copyFromLocal /home/xiaoxu/installSoftware/dataFile/ml-100k/u.user alluxio://192.168.3.210:19999/ml-100k
Copied file:///home/xiaoxu/installSoftware/dataFile/ml-100k/u.user to alluxio://192.168.3.210:19999/ml-100k
# alluxio fs ls /ml-100k
-rw-r--r-- root root 22628 NOT_PERSISTED 03-04-2018 21:50:47:390 100% /ml-100k/u.user