6W+ 字记录实验全过程 | 探索 Alluxio 经济化数据存储策略

0
0
{"value":"![image.png](https://dev-media.amazoncloud.cn/d73b391354a14853abbbdc97a6a72d64_image.png)\n# 探索背景\n随着大数据应用的不断发展,数据仓库、数据湖的大数据实践层出不穷;无论是电信、金融、政府,各个行业的大数据热潮蓬勃发展。在过去的4-5年中,我们不断看到企业用户大数据膨胀问题日益加剧,大数据创新下数据存储成本呈现线性增长,使得企业对于大数据的应用开始变得谨慎、变向放缓了企业内部数据化转型的速度。\n\n# 核心的挑战:如何更加经济地构建数据湖存储体系。\n\n大数据存储引擎从2006年发布以来,百花齐放,计算侧MapReduce、Spark、Hive、Impala、Presto、Storm、Flink的问世不断突破应用领域,不过在大数据存储方面反而显得慎重与沉稳。在过去十多年,在Apache Hadoop生态被广泛提及的主要还是HDFS与Ozone。\n\n# HDFS\n\nHadoop HDFS 是一种分布式文件系统,旨在在商用硬件上运行以提高其普适性。它与现有的分布式文件系统有很多相似之处。但是,HDFS的特点也是鲜明的:具备高度容错性、旨在部署在低成本硬件、允许水平扩缩容。HDFS提供对应用程序数据访问的高吞吐量,适用于需要处理海量数据集的应用服务。\n\n# Ozone\n\nApache Ozone 是一种高度可扩展的分布式存储,适用于分析、大数据和云原生应用程序。Ozone 支持 S3 兼容对象 API 以及 Hadoop 兼容文件系统协议。它针对高效的对象存储和文件系统操作进行了优化。\n\n经济化数据存储策略,主要体现在两个关键特性上,只要实现了,其他的增强都会如虎添翼:\n\n使用最合适的存储系统存储对应的数据分块;\n数据存储策略对上层应用的侵入性越低越好;\n比如HDFS典型场景下使用3副本的策略,一方面是确保数据块的高可用性,同时多个副本也可以更好地保障数据局部性的要求,提高数据访问的吞吐量;为了更好地提供数据服务,硬件环境也会选用相对更好的磁盘;对于早期的大数据实践而言,标准统一的软硬件选择可以提高对新技术栈的推动,但是随着数据的不断积累,很多数据的访问频率呈现指数级下降,尤其是针对合规检查的冷数据,不仅仅占据了生产集群的大量空间,可能一年到头都没有被访问过一次。这是对资源的极大浪费。\n\n大数据发展的现阶段,精细化数据存储被提上了议程。需要一种分层的存储体系,在维系现有计算性能的同时,将温、冷数据实现对上层应用透明的自主迁移,控制数据存储与维护的成本。\n\n# 关键特性验证\n通过这篇文章,我们希望可以对经济化数据存储策略做一个初步探索,首先我们将先前提到的两个关键特性具象化,然后通过几组实验对技术可行性进行一个讨论。\n\n## 关键特性一:使用一套存储系统作为热数据系统;使用另一套存储系统作为冷数据系统;\n\n## 关键特性二:统一命名空间同时兼容多套存储系统,通过统一命名空间对上层应用提供数据访问服务;\n\n## 技术选择:\n\n计算引擎: Hive (大部分企业用户使用SQL引擎作为数据开发工具)\n存储引擎: HDFS/Ozone (业界常用的Apache生态存储)\n数据编排引擎: Alluxio (第三方开源组件,兼容大部分Apache生态组件)\n## Hive\n\nApache Hive ™ 数据仓库软件有助于使用 SQL 读取、写入和管理驻留在分布式存储中的大型数据集。结构可以投影到已经存储的数据上。提供了一个命令行工具和 JDBC 驱动程序允许用户连接到 Hive。\n\n## 关于Alluxio\n\n“Alluxio数据编排系统”是全球首个分布式超大规模数据编排系统,孵化于加州大学伯克利分校AMP实验室。自项目开源以来,**已有超过来自300多个组织机构的1200多位贡献者参与开发。**Alluxio能够在跨集群、跨区域、跨国家的任何云中将数据更紧密地编排到接近数据分析和AI/ML应用程序的集群中,从而向上层应用提供内存级别的数据访问速度。\n\n作为大数据生态系统中的存储与计算分离技术标准,在阿里云、腾讯云、华为云、金山云等国内顶级云厂商服务中得到生产检验,是建设企业私有云的基石和核心技术。2021年成立后,先后荣登“中关村国际前沿科技创新大赛大数据与云计算领域TOP10”、“2021投资界数字科技VENTURE50”、“科创中国”开源创新榜等多项榜单。\n![image.png](https://dev-media.amazoncloud.cn/668c88daca6e4b2aaaddef59e3242926_image.png)\n\n技术可行性研究,我们分两个阶段进行:\n\n**阶段一:**使用同一类型的存储系统HDFS,实现不同HDFS系统之间的冷热分层【模拟场景:使用新的HDFS3.0 EC或者用磁盘密集型的机器专门搭建冷数据HDFS】\n\n**阶段二:**使用不同类型的存储系统,使用HDFS作为热数据存储系统;使用Ozone作为冷数据存储系统 【模拟场景:HDFS负责热数据/Ozone负责冷数据】\n\n# 验证步骤\n## 部署架构\n![image.png](https://dev-media.amazoncloud.cn/c400b2e025674d1caa3205001d538211_image.png)\n\n## 软件版本:\n\n计算引擎:Hive 2.3.9\n存储引擎:Hadoop 2.10.1,Ozone 1.2.1,Alluxio 2.8\n所有组件均为单机模式部署\n## 集群规划:\n![image.png](https://dev-media.amazoncloud.cn/8361024a5085439f93f4f688f3b9d8e3_image.png)\n# 实验一:基于Alluxio实现跨HDFS的透明数据冷热分层\n**## Step 1: 在Hive 中创建库、分区表,默认数据存储在 HDFS_1 上**\n\n```\\ncreate database test location \\"/user/hive/test.db\\";\\ncreate external table test.test_part(value string) partitioned by (dt string);\\n```\n\n#创建库\n\n```\\nhive> create database test location '/user/hive/test.db'; \\nOK \\nTime taken: 1.697 seconds \\nhive> \\n```\n\n#创建表\n\n```\\nhive> create external table test.test_part(value string) partitioned by (dt string); \\nOK \\nTime taken: 0.607 seconds \\nhive> \\n```\n \n**## Step 2: Alluxio Union URI 实现跨HDFS集群统一命名空间集成**\n\n```\\nalluxio fs mount \\\\\\n--option alluxio-union.hdfs1.uri=hdfs://namenode_1:8020/user/hive/test.db/test_part \\\\\\n--option alluxio-union.hdfs2.uri=hdfs://namenode_2:8020/user/hive/test.db/test_part \\\\\\n--option alluxio-union.priority.read=hdfs1,hdfs2 \\\\\\n--option alluxio-union.collection.create=hdfs1 \\\\\\n/user/hive/test.db/test_part union://test_part/ \\n```\n\n#以Alluxio Union URI 方式挂载测试目录\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs mkdir /user/hive/test.db \\nSuccessfully created directory /user/hive/test.db \\n[root@ip-172-31-17-3 conf]# alluxio fs mount \\\\ \\n> --option alluxio-union.hdfs1.uri=hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\\\ \\n> --option alluxio-union.hdfs2.uri=hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\\\ \\n> --option alluxio-union.priority.read=hdfs1,hdfs2 \\\\ \\n> --option alluxio-union.collection.create=hdfs1 \\\\ \\n> /user/hive/test.db/test_part union://test_part/ \\nMounted union://test_part/ at /user/hive/test.db/test_part \\n[root@ip-172-31-17-3 ~]#\\n```\n\n**## Step 3: 修改 Hive 表路径为 Union URI 路径,屏蔽跨异构存储的技术细节**\n\n```\\nalter table test.test_part set location \\"alluxio://alluxio:19998/user/hive/test.db/test_part\\"; \\n```\n\n**#修改Hive表格对应的路径**\n\n```\\nhive> alter table test.test_part set location \\"alluxio://ip-172-31-17-3.us-west-2.compute.internal:19998/user/hive/test.db/test_part\\"; \\nOK \\nTime taken: 0.143 seconds \\nhive> \\n```\n\n**## Step 4: 模拟数据**\n\n```\\nmkdir dt\\\\=2022-06-0{1..6}\\necho 1abc > dt\\\\=2022-06-01/000000_0\\necho 2def > dt\\\\=2022-06-02/000000_0\\necho 3ghi > dt\\\\=2022-06-03/000000_0\\necho 4jkl > dt\\\\=2022-06-04/000000_0\\necho 5mno > dt\\\\=2022-06-05/000000_0\\necho 6pqr > dt\\\\=2022-06-06/000000_0\\nhdfs dfs -put dt\\\\=2022-06-0{1..3} hdfs://namenode_1:8020/user/hive/test.db/test_part\\nhdfs dfs -put dt\\\\=2022-06-0{4..6} hdfs://namenode_2:8020/user/hive/test.db/test_part \\n\\n\\n[root@ip-172-31-17-3 ~]# mkdir dt\\\\=2022-06-0{1..6} \\n[root@ip-172-31-17-3 ~]# echo 1abc > dt\\\\=2022-06-01/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 2def > dt\\\\=2022-06-02/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 3ghi > dt\\\\=2022-06-03/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 4jkl > dt\\\\=2022-06-04/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 5mno > dt\\\\=2022-06-05/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 6pqr > dt\\\\=2022-06-06/000000_0 \\n```\n\n**#将模拟数据分别存入hdfs1、hdfs2**\n\n```\\n[root@ip-172-31-17-3 ~]# hdfs dfs -put dt\\\\=2022-06-0{1..3} hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\n[root@ip-172-31-17-3 ~]# hdfs dfs -mkdir -p hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\n[root@ip-172-31-17-3 ~]# hdfs dfs -put dt\\\\=2022-06-0{4..6} hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\n```\n\n**#查询hdfs1和hdfs2,确认数据存入完成**\n\n```\\n[root@ip-172-31-17-3 ~]# hdfs dfs -ls hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\nFound 3 items \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:09 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-01 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:09 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-02 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:09 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-03 \\n[root@ip-172-31-17-3 ~]# hdfs dfs -ls hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\nFound 3 items \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-04 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-05 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-06 \\n```\n\n**#通过查询alluxio Union URI 再次确认数据存入hdfs1和hdfs2,以及Union URI跨存储关联生效**\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs ls /user/hive/test.db/test_part \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:09:19:243 DIR /user/hive/test.db/test_part/dt=2022-06-02 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:09:19:219 DIR /user/hive/test.db/test_part/dt=2022-06-01 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:10:49:740 DIR /user/hive/test.db/test_part/dt=2022-06-06 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:10:49:721 DIR /user/hive/test.db/test_part/dt=2022-06-05 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:10:49:698 DIR /user/hive/test.db/test_part/dt=2022-06-04 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:09:19:263 DIR /user/hive/test.db/test_part/dt=2022-06-03 \\n[root@ip-172-31-17-3 ~]#\\n```\n\n**## Step 5: 刷新Hive表元数据**\n\n```\\nMSCK REPAIR TABLE test.test_part;\\nhive> MSCK REPAIR TABLE test.test_part; \\nOK \\nPartitions not in metastore: test_part:dt=2022-06-01 test_part:dt=2022-06-02 test_part:dt=2022-06-03 test_part:dt=2022-06-04 test_part:dt=2022-06-05 test_part:dt=2022-06-06 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-01 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-02 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-03 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-04 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-05 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-06 \\nTime taken: 1.677 seconds, Fetched: 7 row(s)\\n```\n\n**#通过select方式观察到Hive元数据刷新后,alluxio union URI关联生效体现到Hive表中**\n\n```\\nhive> select * from test.test_part; \\nOK \\n1abc 2022-06-01 \\n2def 2022-06-02 \\n3ghi 2022-06-03 \\n4jkl 2022-06-04 \\n5mno 2022-06-05 \\n6pqr 2022-06-06 \\nTime taken: 1.624 seconds, Fetched: 6 row(s) \\nhive>\\n```\n\n**## Step 6: 配置冷热自动分层策略**\n\n```\\nalluxio fs policy add /user/hive/test.db/test_part \\"ufsMigrate(olderThan(2m), UFS[hdfs1]:REMOVE, UFS[hdfs2]:STORE)\\" \\n```\n\n**#设置策略:冷数据(本例中按生成超过2分钟的数据)自动从热存储(hdfs1)迁移到冷存储(hdfs2)**\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs policy add /user/hive/test.db/test_part \\"ufsMigrate(olderThan(2m), UFS[hdfs1]:REMOVE, UFS[hdfs2]:STORE)\\" \\nPolicy ufsMigrate-/user/hive/test.db/test_part is added to /user/hive/test.db/test_part. \\n```\n \n**#通过Alluxio命令行查看策略设置成功与否**\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs policy list \\nid: 1657700423909 \\nname: \\"ufsMigrate-/user/hive/test.db/test_part\\" \\npath: \\"/user/hive/test.db/test_part\\" \\ncreated_at: 1657700423914 \\nscope: \\"RECURSIVE\\" \\ncondition: \\"olderThan(2m)\\" \\naction: \\"DATA(UFS[hdfs1]:REMOVE, UFS[hdfs2]:STORE)\\" \\n[root@ip-172-31-17-3 ~]#\\n```\n\n**#策略生效后分别查看hdfs1和hdfs2,可以观察到hdfs1里面超过2分钟的数据都迁移到hdfs2中**\n\n```\\n[root@ip-172-31-17-3 logs]# hdfs dfs -ls hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\n[root@ip-172-31-17-3 logs]# hdfs dfs -ls hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\nFound 6 items \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:26 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-01 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:26 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-02 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:26 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-03 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-04 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-05 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-06 \\n[root@ip-172-31-17-3 logs]#\\n```\n\n**#策略生效,冷数据自动迁移过程中和完成后查Hive都得到如下预期查询结果:**\n\n```\\nhive> select * from test.test_part; \\nOK \\n1abc 2022-06-01 \\n2def 2022-06-02 \\n3ghi 2022-06-03 \\n4jkl 2022-06-04 \\n5mno 2022-06-05 \\n6pqr 2022-06-06 \\nTime taken: 0.172 seconds, Fetched: 6 row(s) \\nhive>\\n```\n\n最后,我们将实验一的两个步骤:(1)通过Alluxio的Union URI实现跨两个HDFS存储系统的Hive表的数据联邦,和(2)通过Alluxio实现跨两个HDFS存储系统的透明数据冷热分层,在图1和图2中分别以简化示意图的方式展示,便于更好的理解实验目标、过程和结果。\n![image.png](https://dev-media.amazoncloud.cn/bc810fda42ed450aad4534675977872e_image.png)\n\n图1:通过Alluxio的Union URI实现跨两个HDFS存储系统的Hive表的数据联邦的示意图\n![image.png](https://dev-media.amazoncloud.cn/b2e74fff7f6348c69cd0b3e23a5e4218_image.png)\n图2:通过Alluxio实现跨两个HDFS存储系统的透明数据冷热分层示意图\n下一组实验只是将上一组实验设定中的两个HDFS存储系统更改成了两个异构存储系统HDFS(热存储)和Ozone(冷存储),从透明冷热分层功能层面效果是相同的。\n\n# 实验二:基于Alluxio实现跨异构存储(HDFS和Ozone)的透明数据冷热分层\n## ## step 1 : hive 创建库、表\n\n```\\ncreate database hdfsToOzone location '/user/hive/hdfsToOzone.db';\\ncreate external table hdfsToOzone.test(value string) partitioned by (dt string);\\n```\n\n## #创建库\n\n```\\nhive> create database hdfsToOzone location '/user/hive/hdfsToOzone.db'; \\nOK \\nTime taken: 0.055 seconds \\nhive>\\n```\n\n## #创建表\n\n```\\nhive> create external table hdfsToOzone.test(value string) partitioned by (dt string); \\nOK \\nTime taken: 0.1 seconds \\nhive>\\n```\n\n## ## step 2: Alluxio Union URI实现跨HDFS/Ozone集群统一命名空间集成\n\n```\\nalluxio fs mount \\\\\\n--option alluxio-union.hdfs.uri=hdfs://HDFS1:8020/user/hive/hdfsToOzone.db/test \\\\\\n--option alluxio-union.ozone.uri=o3fs://bucket.volume/hdfsToOzone.db/test \\\\\\n--option alluxio-union.priority.read=hdfs,ozone \\\\\\n--option alluxio-union.collection.create=hdfs \\\\\\n--option alluxio.underfs.hdfs.configuration=/mnt1/ozone-1.2.1/etc/hadoop/ozone-site.xml \\\\\\n/user/hive/hdfsToOzone.db/test union://HDFS_TO_OZONE/ \\n```\n\n## #在Ozone中使用命令行工具创建volume、bucket\n\n```\\n[root@ip-172-31-19-127 ~]# ozone sh volume create /v-alluxio \\n[root@ip-172-31-19-127 ~]# ozone sh bucket create /v-alluxio/b-alluxio \\n[root@ip-172-31-19-127 ~]# ozone fs -mkdir -p o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\n[root@ip-172-31-19-127 ~]# \\n```\n\n## #先在Alluxio中创建实验目录,然后以 Union URI 方式挂载目录\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs mkdir /user/hive/hdfsToOzone.db\\nSuccessfully created directory /user/hive/hdfsToOzone.db\\n[root@ip-172-31-17-3 ~]# alluxio fs mount \\\\ \\n> --option alluxio-union.hdfs.uri=hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test \\\\ \\n> --option alluxio-union.ozone.uri=o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\\\ \\n> --option alluxio-union.priority.read=hdfs,ozone \\\\ \\n> --option alluxio-union.collection.create=hdfs \\\\ \\n> --option alluxio.underfs.hdfs.configuration=/mnt1/ozone-1.2.1/etc/hadoop/ozone-site.xml \\\\ \\n> /user/hive/hdfsToOzone.db/test union://HDFS_TO_OZONE/ \\nMounted union://HDFS_TO_OZONE/ at /user/hive/hdfsToOzone.db/test \\n[root@ip-172-31-17-3 ~]#\\n```\n\n## ## step 3: 修改 Hive 表路径为 Union URI 路径,屏蔽跨异构存储的技术细节\n\n```\\nalter table hdfsToOzone.test set location \\"alluxio://alluxio:19998/user/hive/hdfsToOzone.db/test\\"; \\n```\n\n## #修改Hive表格对应的路径\n\n```\\nhive> alter table hdfsToOzone.test set location \\"alluxio://ip-172-31-17-3.us-west-2.compute.internal:19998/user/hive/hdfsToOzone.db/test\\"; \\nOK \\nTime taken: 1.651 seconds \\nhive> \\n```\n\n## ## step 4: 模拟数据\n\n```\\nozone fs -put dt\\\\=2022-06-0{1..3} o3fs://b-alluxio.v-alluxio.ozone:9862/hdfsToOzone.db/test \\nhdfs dfs -put dt\\\\=2022-06-0{4..6} hdfs://HDFS1:8020/user/hive/hdfsToOzone.db/test\\n```\n\n## #将数据存入ozone\n\n```\\n[root@ip-172-31-19-127 ~]# ozone fs -put dt\\\\=2022-06-0{1..3} o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\n2022-07-13 10:00:38,920 [main] INFO impl.MetricsConfig: Loaded properties from hadoop-metrics2.properties \\n2022-07-13 10:00:38,981 [main] INFO impl.MetricsSystemImpl: Scheduled Metric snapshot period at 10 second(s). \\n2022-07-13 10:00:38,981 [main] INFO impl.MetricsSystemImpl: XceiverClientMetrics metrics system started \\n2022-07-13 10:00:39,198 [main] INFO metrics.MetricRegistries: Loaded MetricRegistries class org.apache.ratis.metrics.impl.MetricRegistriesImpl\\n```\n\n## #通过命令行查询ozone,确认数据存入完成\n\n```\\n[root@ip-172-31-19-127 ~]# ozone fs -ls o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\nFound 3 items \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-01 \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-02 \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-03 \\n[root@ip-172-31-19-127 ~]#\\n```\n\n## #将数据存入hdfs1,并通过命令行查询hdfs1,确认数据存入完成\n\n```\\n[root@ip-172-31-17-3 ~]# hdfs dfs -put dt\\\\=2022-06-0{4..6} hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test \\n[root@ip-172-31-17-3 ~]# hdfs dfs -ls hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test \\nFound 3 items \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 10:06 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test/dt=2022-06-04 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 10:06 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test/dt=2022-06-05 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 10:06 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test/dt=2022-06-06 \\n[root@ip-172-31-17-3 ~]#\\n```\n\n## #通过Alluxio命令行查询,再次确认数据存入hdfs1和ozone,以及Union URI跨存储关联生效\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs ls /user/hive/hdfsToOzone.db/test \\ndrwxrwxrwx root root 0 PERSISTED 07-13-2022 10:00:40:670 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-02 \\ndrwxrwxrwx root root 0 PERSISTED 07-13-2022 10:00:38:691 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-01 \\ndrwxr-xr-x root hdfsadmingroup 0 PERSISTED 07-13-2022 10:06:29:206 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-06 \\ndrwxr-xr-x root hdfsadmingroup 0 PERSISTED 07-13-2022 10:06:29:186 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-05 \\ndrwxr-xr-x root hdfsadmingroup 0 PERSISTED 07-13-2022 10:06:29:161 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-04 \\ndrwxrwxrwx root root 0 PERSISTED 07-13-2022 10:00:40:762 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-03 \\n[root@ip-172-31-17-3 ~]# \\n\\n```\n## ## step 5: 刷新Hive表元数据\n\n```\\nMSCK REPAIR TABLE hdfsToOzone.test;\\nhive> MSCK REPAIR TABLE hdfsToOzone.test; \\nOK \\nPartitions not in metastore: test:dt=2022-06-01 test:dt=2022-06-02 test:dt=2022-06-03 test:dt=2022-06-04 test:dt=2022-06-05 test:dt=2022-06-06 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-01 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-02 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-03 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-04 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-05 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-06 \\nTime taken: 0.641 seconds, Fetched: 7 row(s) \\nhive>\\n```\n\n## #通过select方式观察到hive元数据刷新后,alluxio union URI关联生效体现到hive表中\n\n```\\nhive> select * from hdfsToOzone.test ; \\nOK \\n1abc 2022-06-01 \\n2def 2022-06-02 \\n3ghi 2022-06-03 \\n4jkl 2022-06-04 \\n5mno 2022-06-05 \\n6pqr 2022-06-06 \\nTime taken: 0.156 seconds, Fetched: 6 row(s) \\nhive>\\n```\n\n## ## step 6: 配置策略\n\n```\\nalluxio fs policy add /user/hive/hdfsToOzone.db/test\\" ufsMigrate(olderThan(2m), UFS[hdfs]:REMOVE, UFS[ozone]:STORE)\\" \\n```\n\n## #设置策略:冷数据(本例中按生成超过2分钟的数据)自动从热存储(hdfs1)迁移到冷存储(ozone)\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs policy add /user/hive/hdfsToOzone.db/test/ \\"ufsMigrate(olderThan(2m), UFS[hdfs]:REMOVE, UFS[ozone]:STORE)\\" \\nPolicy ufsMigrate-/user/hive/hdfsToOzone.db/test is added to /user/hive/hdfsToOzone.db/test.\\n```\n\n## #通过Alluxio命令行查看策略设置成功与否\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs policy list \\nid: 1657707130843 \\nname: \\"ufsMigrate-/user/hive/hdfsToOzone.db/test\\" \\npath: \\"/user/hive/hdfsToOzone.db/test\\" \\ncreated_at: 1657707130843 \\nscope: \\"RECURSIVE\\" \\ncondition: \\"olderThan(2m)\\" \\naction: \\"DATA(UFS[hdfs]:REMOVE, UFS[ozone]:STORE)\\" \\n[root@ip-172-31-17-3 ~]# \\n```\n \n## #策略生效后分别查看hdfs1和ozone,可以观察到hdfs1里面超过2分钟的数据都迁移到ozone中\n\n```\\n[root@ip-172-31-17-3 ~]# ozone fs -ls o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\nFound 6 items \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-01 \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-02 \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-03 \\ndrwxrwxrwx - root root 0 2022-07-13 10:21 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-04 \\ndrwxrwxrwx - root root 0 2022-07-13 10:21 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-05 \\ndrwxrwxrwx - root root 0 2022-07-13 10:21 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-06 \\n[root@ip-172-31-17-3 ~]# hdfs dfs -ls hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test \\n[root@ip-172-31-17-3 ~]# \\n```\n\n## #策略生效,冷数据自动迁移过程中和完成后查hive都得到如下预期查询结果:\n\n```\\nhive> select * from hdfsToOzone.test ; \\nOK \\n1abc 2022-06-01 \\n2def 2022-06-02 \\n3ghi 2022-06-03 \\n4jkl 2022-06-04 \\n5mno 2022-06-05 \\n6pqr 2022-06-06 \\nTime taken: 0.144 seconds, Fetched: 6 row(s) \\nhive> \\n```\n\n## 4. 实验小结\n可以看出,实验二的执行过程和效果展示和实验一几乎是如出一辙,除了冷数据存储系统从hdfs2切换成了一个异构存储系统Ozone。\n\n通过实验,我们充分验证了Alluxio数据编排是如何成功将上层应用 (比如基于Hive的数仓建设) 与底层数据持久化策略 (使用hdfs或者Ozone, 是否进行冷热分层等) 解耦合的。同时也体现了Alluxio对于异构存储系统的通用性和易用性。\n\n最后希望这篇文章对各位如何使用Alluxio经济化数据存储策略有所启迪。\n\n# 附录\n## Alluxio集成Hive及HDFS的方式\nAlluxio 配置\n\n> echo 'export ALLX_HOME=/mnt1/alluxio' >> ~/.bashrc\necho 'export PATH=\$PATH:\$ALLX_HOME/bin' >> ~/.bashrc\n```\\nalluxio.master.hostname=ip-172-31-17-3.us-west-2.compute.internal \\nalluxio.underfs.address=hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/alluxio \\nalluxio.worker.tieredstore.level0.dirs.path=/alluxio/ramdisk\\n\\nalluxio.worker.memory.size=4G\\nalluxio.worker.tieredstore.levels=1\\nalluxio.worker.tieredstore.level0.alias=MEM\\nalluxio.user.file.readtype.default=CACHE\\nalluxio.user.file.writetype.default=ASYNC_THROUGH\\nalluxio.security.login.impersonation.username=_HDFS_USER_\\nalluxio.master.security.impersonation.yarn.groups=*\\nalluxio.master.security.impersonation.hive.groups=*\\nalluxio.user.metrics.collection.enabled=true\\nalluxio.user.block.size.bytes.default=64MB\\n\\n######## Explore ########\\nalluxio.user.block.write.location.policy.class=alluxio.client.block.policy.DeterministicHashPolicy\\nalluxio.user.ufs.block.read.location.policy=alluxio.client.block.policy.DeterministicHashPolicy\\nalluxio.user.ufs.block.read.location.policy.deterministic.hash.shards=1\\nalluxio.user.file.persist.on.rename=true\\nalluxio.master.persistence.blacklist=.staging,_temporary,.tmp\\nalluxio.user.file.passive.cache.enabled=false \\n```\n\nHive 客户端core-site.xml\n\n> cp /hadoop_home/etc/hadoop/core-site.xml /hive_home/conf\n## 拷贝 jar分别到hadoop和hive home下的lib子目录中\n\n```\\ncp /<PATH_TO_ALLUXIO>/client/alluxio-enterprise-2.8.0-1.0-client.jar /hadoop_home/share/lib \\ncp /<PATH_TO_ALLUXIO>/client/alluxio-enterprise-2.8.0-1.0-client.jar /hive_home/lib\\n```\n\n## 配置alluxio文件系统\n\n```\\nvim /hive_home/conf/core-site.xml \\n<property>\\n <name>fs.alluxio.impl</name>\\n <value>alluxio.hadoop.FileSystem</value>\\n</property>\\n<property>\\n <name>alluxio.master.rpc.addresses</name>\\n <value>ip-172-31-17-3.us-west-2.compute.internal:19998</value>\\n</property> \\n```\n\nHDFS授权\n\n## 查看hdfs 超级用户\n\n```\\nvim /hadoop_home/etc/hadoop/hdfs-site.xml\\n<property>\\n<name>dfs.permissions.superusergroup</name>\\n<value>hdfsadmingroup</value>\\n</property>\\n```\n\n## 将用户 Alluxio 增加到supergroup\n\n```\\ngroupadd hdfsadmingroup\\nusermod -a -G hdfsadmingroup root\\n```\n\n## 同步系统的权限信息到 HDFS\n\n```\\nsu - hdfs -s /bin/bash -c \\"hdfs dfsadmin -refreshUserToGroupsMappings\\"\\n```\n\n## 开启hdfs acl\n\n```\\nvim /hadoop_home/etc/hadoop/hdfs-site.xml\\n<property>\\n<name>dfs.permissions.enabled</name>\\n<value>true</value>\\n</property>\\n<property>\\n<name>dfs.namenode.acls.enabled</name>\\n<value>true</value>\\n</property> \\nsu - hdfs -s /bin/bash -c \\"hdfs dfs -setfacl -R -m user:root:rwx /\\"\\n```\n\n## Ozone 部署\n配置文件\n\n```\\nwget https://dlcdn.apache.org/ozone/1.2.1/ozone-1.2.1.tar.gz \\necho 'export OZONE_HOME=/mnt1/ozone-1.2.1' >> ~/.bashrc\\necho 'export PATH=\$PATH:\$OZONE_HOME/bin:\$OZONE_HOME/sbin' >> ~/.bashrc\\n```\n \n##在ozone-site.xml中加入必要配置信息\n\n```\\n<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"yes\\"?>\\n<configuration>\\n<property>\\n<name>ozone.om.address</name>\\n<value>ip-172-31-19-127.us-west-2.compute.internal:9862</value>\\n</property>\\n<property>\\n<name>ozone.metadata.dirs</name>\\n<value>/mnt/ozone-1.2.1/metadata/ozone</value>\\n</property>\\n<property>\\n<name>ozone.scm.client.address</name>\\n<value>ip-172-31-19-127.us-west-2.compute.internal:9860</value>\\n</property>\\n<property>\\n<name>ozone.scm.names</name>\\n<value>ip-172-31-19-127.us-west-2.compute.internal</value>\\n</property>\\n<property>\\n<name>ozone.scm.datanode.id.dir</name>\\n<value>/mnt/ozone-1.2.1/metadata/ozone/node</value>\\n</property>\\n<property>\\n<name>ozone.om.db.dirs</name>\\n<value>/mnt/ozone-1.2.1/metadata/ozone/omdb</value>\\n</property>\\n<property>\\n<name>ozone.scm.db.dirs</name>\\n<value>/mnt/ozone-1.2.1/metadata/ozone/scmdb</value>\\n</property>\\n<property>\\n<name>hdds.datanode.dir</name>\\n<value>/mnt/ozone-1.2.1/datanode/data</value>\\n</property>\\n<property>\\n<name>ozone.om.ratis.enable</name>\\n<value>false</value>\\n</property>\\n<property>\\n<name>ozone.om.http-address</name>\\n<value>ip-172-31-19-127.us-west-2.compute.internal:9874</value>\\n</property>\\n<property>\\n<name>ozone.s3g.domain.name</name>\\n<value>s3g.internal</value>\\n</property>\\n<property>\\n<name>ozone.replication</name>\\n<value>1</value>\\n</property>\\n</configuration> \\n```\n\n初始化与启动(按照顺序)\n\n```\\nozone scm --init\\nozone --daemon start scm\\nozone om --init\\nozone --daemon start om \\nozone --daemon start datanode\\nozone --daemon start s3g \\nozone使用操作\\n```\n\n\n#创建名称为v-alluxio的volume\n\n```\\n[root@ip-172-31-19-127 ~]# ozone sh volume create /v-alluxio \\n[root@ip-172-31-19-127 ~]#\\n```\n\n#在v-alluxio下创建名为b-alluxio的bucket\n\n```\\n[root@ip-172-31-19-127 ~]# ozone sh bucket create /v-alluxio/b-alluxio \\n[root@ip-172-31-19-127 ~]#\\n```\n\n#查看bucket的相关信息\n\n```\\n[root@ip-172-31-19-127 ~]# ozone sh bucket info /v-alluxio/b-alluxio \\n{ \\n \\"metadata\\" : { }, \\n \\"volumeName\\" : \\"v-alluxio\\", \\n \\"name\\" : \\"b-alluxio\\", \\n \\"storageType\\" : \\"DISK\\", \\n \\"versioning\\" : false, \\n \\"usedBytes\\" : 30, \\n \\"usedNamespace\\" : 6, \\n \\"creationTime\\" : \\"2022-07-13T09:11:37.403Z\\", \\n \\"modificationTime\\" : \\"2022-07-13T09:11:37.403Z\\", \\n \\"quotaInBytes\\" : -1, \\n \\"quotaInNamespace\\" : -1, \\n \\"bucketLayout\\" : \\"LEGACY\\" \\n} \\n[root@ip-172-31-19-127 ~]#\\n#创建key,并放入相应的内容\\n\\n[root@ip-172-31-19-127 ~]# touch Dockerfile \\n[root@ip-172-31-19-127 ~]# ozone sh key put /v-alluxio/b-alluxio/Dockerfile Dockerfile \\n[root@ip-172-31-19-127 ~]#\\n#列出bucket下所有的key\\n\\n[root@ip-172-31-19-127 ~]# ozone sh key list /v-alluxio/b-alluxio/\\n{ \\n \\"volumeName\\" : \\"v-alluxio\\", \\n \\"bucketName\\" : \\"b-alluxio\\", \\n \\"name\\" : \\"Dockerfile\\", \\n \\"dataSize\\" : 0, \\n \\"creationTime\\" : \\"2022-07-13T14:37:09.761Z\\", \\n \\"modificationTime\\" : \\"2022-07-13T14:37:09.801Z\\", \\n \\"replicationConfig\\" : { \\n \\"replicationFactor\\" : \\"ONE\\", \\n \\"requiredNodes\\" : 1, \\n \\"replicationType\\" : \\"RATIS\\" \\n }, \\n \\"replicationFactor\\" : 1, \\n \\"replicationType\\" : \\"RATIS\\" \\n}\\n[root@ip-172-31-19-127 ~]#\\n```\n\n#查看key的相关信息\n\n```\\n[root@ip-172-31-19-127 ~]# ozone sh key info /v-alluxio/b-alluxio/Dockerfile \\n{ \\n \\"volumeName\\" : \\"v-alluxio\\", \\n \\"bucketName\\" : \\"b-alluxio\\", \\n \\"name\\" : \\"Dockerfile\\", \\n \\"dataSize\\" : 0, \\n \\"creationTime\\" : \\"2022-07-13T14:37:09.761Z\\", \\n \\"modificationTime\\" : \\"2022-07-13T14:37:09.801Z\\", \\n \\"replicationConfig\\" : { \\n \\"replicationFactor\\" : \\"ONE\\", \\n \\"requiredNodes\\" : 1, \\n \\"replicationType\\" : \\"RATIS\\" \\n }, \\n \\"ozoneKeyLocations\\" : [ ], \\n \\"metadata\\" : { }, \\n \\"replicationFactor\\" : 1, \\n \\"replicationType\\" : \\"RATIS\\" \\n} \\n[root@ip-172-31-19-127 ~]#\\n\\n```\nAlluxio 挂载 ozone\n\n#方式一\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs mount /ozone o3fs://b-alluxio.v-alluxio.ip-172-31-19-127.us-west-2.compute.internal:9862/ \\nMounted o3fs://b-alluxio.v-alluxio.ip-172-31-19-127.us-west-2.compute.internal:9862/ at /ozone \\n[root@ip-172-31-17-3 ~]#\\n```\n\n#方式二(带option的mount)\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs mount \\\\ \\n> --option alluxio.underfs.hdfs.configuration=/mnt1/ozone-1.2.1/etc/hadoop/ozone-site.xml \\\\ \\n> /ozone1 o3fs://b-alluxio.v-alluxio/ \\nMounted o3fs://b-alluxio.v-alluxio/ at /ozone1 \\n[root@ip-172-31-17-3 ~]# \\n```\n\n#验证Ozone挂载是否成功\n\n```\\n[root@ip-172-31-17-3 ~]# alluxio fs ls / \\ndrwxrwxrwx root root 0 PERSISTED 01-01-1970 00:00:00:000 DIR /ozone1 \\ndrwxrwxrwx root root 0 PERSISTED 01-01-1970 00:00:00:000 DIR /ozone \\n[root@ip-172-31-17-3 ~]#\\n```\n","render":"<p><img src=\\"https://dev-media.amazoncloud.cn/d73b391354a14853abbbdc97a6a72d64_image.png\\" alt=\\"image.png\\" /></p>\n<h1><a id=\\"_1\\"></a>探索背景</h1>\\n<p>随着大数据应用的不断发展,数据仓库、数据湖的大数据实践层出不穷;无论是电信、金融、政府,各个行业的大数据热潮蓬勃发展。在过去的4-5年中,我们不断看到企业用户大数据膨胀问题日益加剧,大数据创新下数据存储成本呈现线性增长,使得企业对于大数据的应用开始变得谨慎、变向放缓了企业内部数据化转型的速度。</p>\n<h1><a id=\\"_4\\"></a>核心的挑战:如何更加经济地构建数据湖存储体系。</h1>\\n<p>大数据存储引擎从2006年发布以来,百花齐放,计算侧MapReduce、Spark、Hive、Impala、Presto、Storm、Flink的问世不断突破应用领域,不过在大数据存储方面反而显得慎重与沉稳。在过去十多年,在Apache Hadoop生态被广泛提及的主要还是HDFS与Ozone。</p>\n<h1><a id=\\"HDFS_8\\"></a>HDFS</h1>\\n<p>Hadoop HDFS 是一种分布式文件系统,旨在在商用硬件上运行以提高其普适性。它与现有的分布式文件系统有很多相似之处。但是,HDFS的特点也是鲜明的:具备高度容错性、旨在部署在低成本硬件、允许水平扩缩容。HDFS提供对应用程序数据访问的高吞吐量,适用于需要处理海量数据集的应用服务。</p>\n<h1><a id=\\"Ozone_12\\"></a>Ozone</h1>\\n<p>Apache Ozone 是一种高度可扩展的分布式存储,适用于分析、大数据和云原生应用程序。Ozone 支持 S3 兼容对象 API 以及 Hadoop 兼容文件系统协议。它针对高效的对象存储和文件系统操作进行了优化。</p>\n<p>经济化数据存储策略,主要体现在两个关键特性上,只要实现了,其他的增强都会如虎添翼:</p>\n<p>使用最合适的存储系统存储对应的数据分块;<br />\\n数据存储策略对上层应用的侵入性越低越好;<br />\\n比如HDFS典型场景下使用3副本的策略,一方面是确保数据块的高可用性,同时多个副本也可以更好地保障数据局部性的要求,提高数据访问的吞吐量;为了更好地提供数据服务,硬件环境也会选用相对更好的磁盘;对于早期的大数据实践而言,标准统一的软硬件选择可以提高对新技术栈的推动,但是随着数据的不断积累,很多数据的访问频率呈现指数级下降,尤其是针对合规检查的冷数据,不仅仅占据了生产集群的大量空间,可能一年到头都没有被访问过一次。这是对资源的极大浪费。</p>\n<p>大数据发展的现阶段,精细化数据存储被提上了议程。需要一种分层的存储体系,在维系现有计算性能的同时,将温、冷数据实现对上层应用透明的自主迁移,控制数据存储与维护的成本。</p>\n<h1><a id=\\"_24\\"></a>关键特性验证</h1>\\n<p>通过这篇文章,我们希望可以对经济化数据存储策略做一个初步探索,首先我们将先前提到的两个关键特性具象化,然后通过几组实验对技术可行性进行一个讨论。</p>\n<h2><a id=\\"_27\\"></a>关键特性一:使用一套存储系统作为热数据系统;使用另一套存储系统作为冷数据系统;</h2>\\n<h2><a id=\\"_29\\"></a>关键特性二:统一命名空间同时兼容多套存储系统,通过统一命名空间对上层应用提供数据访问服务;</h2>\\n<h2><a id=\\"_31\\"></a>技术选择:</h2>\\n<p>计算引擎: Hive (大部分企业用户使用SQL引擎作为数据开发工具)<br />\\n存储引擎: HDFS/Ozone (业界常用的Apache生态存储)<br />\\n数据编排引擎: Alluxio (第三方开源组件,兼容大部分Apache生态组件)</p>\n<h2><a id=\\"Hive_36\\"></a>Hive</h2>\\n<p>Apache Hive ™ 数据仓库软件有助于使用 SQL 读取、写入和管理驻留在分布式存储中的大型数据集。结构可以投影到已经存储的数据上。提供了一个命令行工具和 JDBC 驱动程序允许用户连接到 Hive。</p>\n<h2><a id=\\"Alluxio_40\\"></a>关于Alluxio</h2>\\n<p>“Alluxio数据编排系统”是全球首个分布式超大规模数据编排系统,孵化于加州大学伯克利分校AMP实验室。自项目开源以来,**已有超过来自300多个组织机构的1200多位贡献者参与开发。**Alluxio能够在跨集群、跨区域、跨国家的任何云中将数据更紧密地编排到接近数据分析和AI/ML应用程序的集群中,从而向上层应用提供内存级别的数据访问速度。</p>\n<p>作为大数据生态系统中的存储与计算分离技术标准,在阿里云、腾讯云、华为云、金山云等国内顶级云厂商服务中得到生产检验,是建设企业私有云的基石和核心技术。2021年成立后,先后荣登“中关村国际前沿科技创新大赛大数据与云计算领域TOP10”、“2021投资界数字科技VENTURE50”、“科创中国”开源创新榜等多项榜单。<br />\\n<img src=\\"https://dev-media.amazoncloud.cn/668c88daca6e4b2aaaddef59e3242926_image.png\\" alt=\\"image.png\\" /></p>\n<p>技术可行性研究,我们分两个阶段进行:</p>\n<p>**阶段一:**使用同一类型的存储系统HDFS,实现不同HDFS系统之间的冷热分层【模拟场景:使用新的HDFS3.0 EC或者用磁盘密集型的机器专门搭建冷数据HDFS】</p>\n<p>**阶段二:**使用不同类型的存储系统,使用HDFS作为热数据存储系统;使用Ozone作为冷数据存储系统 【模拟场景:HDFS负责热数据/Ozone负责冷数据】</p>\n<h1><a id=\\"_53\\"></a>验证步骤</h1>\\n<h2><a id=\\"_54\\"></a>部署架构</h2>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/c400b2e025674d1caa3205001d538211_image.png\\" alt=\\"image.png\\" /></p>\n<h2><a id=\\"_57\\"></a>软件版本:</h2>\\n<p>计算引擎:Hive 2.3.9<br />\\n存储引擎:Hadoop 2.10.1,Ozone 1.2.1,Alluxio 2.8<br />\\n所有组件均为单机模式部署</p>\n<h2><a id=\\"_62\\"></a>集群规划:</h2>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/8361024a5085439f93f4f688f3b9d8e3_image.png\\" alt=\\"image.png\\" /></p>\n<h1><a id=\\"AlluxioHDFS_64\\"></a>实验一:基于Alluxio实现跨HDFS的透明数据冷热分层</h1>\\n<p><strong>## Step 1: 在Hive 中创建库、分区表,默认数据存储在 HDFS_1 上</strong></p>\\n<pre><code class=\\"lang-\\">create database test location &quot;/user/hive/test.db&quot;;\\ncreate external table test.test_part(value string) partitioned by (dt string);\\n</code></pre>\\n<p>#创建库</p>\n<pre><code class=\\"lang-\\">hive&gt; create database test location '/user/hive/test.db'; \\nOK \\nTime taken: 1.697 seconds \\nhive&gt; \\n</code></pre>\\n<p>#创建表</p>\n<pre><code class=\\"lang-\\">hive&gt; create external table test.test_part(value string) partitioned by (dt string); \\nOK \\nTime taken: 0.607 seconds \\nhive&gt; \\n</code></pre>\\n<p><strong>## Step 2: Alluxio Union URI 实现跨HDFS集群统一命名空间集成</strong></p>\\n<pre><code class=\\"lang-\\">alluxio fs mount \\\\\\n--option alluxio-union.hdfs1.uri=hdfs://namenode_1:8020/user/hive/test.db/test_part \\\\\\n--option alluxio-union.hdfs2.uri=hdfs://namenode_2:8020/user/hive/test.db/test_part \\\\\\n--option alluxio-union.priority.read=hdfs1,hdfs2 \\\\\\n--option alluxio-union.collection.create=hdfs1 \\\\\\n/user/hive/test.db/test_part union://test_part/ \\n</code></pre>\\n<p>#以Alluxio Union URI 方式挂载测试目录</p>\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs mkdir /user/hive/test.db \\nSuccessfully created directory /user/hive/test.db \\n[root@ip-172-31-17-3 conf]# alluxio fs mount \\\\ \\n&gt; --option alluxio-union.hdfs1.uri=hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\\\ \\n&gt; --option alluxio-union.hdfs2.uri=hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\\\ \\n&gt; --option alluxio-union.priority.read=hdfs1,hdfs2 \\\\ \\n&gt; --option alluxio-union.collection.create=hdfs1 \\\\ \\n&gt; /user/hive/test.db/test_part union://test_part/ \\nMounted union://test_part/ at /user/hive/test.db/test_part \\n[root@ip-172-31-17-3 ~]#\\n</code></pre>\\n<p><strong>## Step 3: 修改 Hive 表路径为 Union URI 路径,屏蔽跨异构存储的技术细节</strong></p>\\n<pre><code class=\\"lang-\\">alter table test.test_part set location &quot;alluxio://alluxio:19998/user/hive/test.db/test_part&quot;; \\n</code></pre>\\n<p><strong>#修改Hive表格对应的路径</strong></p>\\n<pre><code class=\\"lang-\\">hive&gt; alter table test.test_part set location &quot;alluxio://ip-172-31-17-3.us-west-2.compute.internal:19998/user/hive/test.db/test_part&quot;; \\nOK \\nTime taken: 0.143 seconds \\nhive&gt; \\n</code></pre>\\n<p><strong>## Step 4: 模拟数据</strong></p>\\n<pre><code class=\\"lang-\\">mkdir dt\\\\=2022-06-0{1..6}\\necho 1abc &gt; dt\\\\=2022-06-01/000000_0\\necho 2def &gt; dt\\\\=2022-06-02/000000_0\\necho 3ghi &gt; dt\\\\=2022-06-03/000000_0\\necho 4jkl &gt; dt\\\\=2022-06-04/000000_0\\necho 5mno &gt; dt\\\\=2022-06-05/000000_0\\necho 6pqr &gt; dt\\\\=2022-06-06/000000_0\\nhdfs dfs -put dt\\\\=2022-06-0{1..3} hdfs://namenode_1:8020/user/hive/test.db/test_part\\nhdfs dfs -put dt\\\\=2022-06-0{4..6} hdfs://namenode_2:8020/user/hive/test.db/test_part \\n\\n\\n[root@ip-172-31-17-3 ~]# mkdir dt\\\\=2022-06-0{1..6} \\n[root@ip-172-31-17-3 ~]# echo 1abc &gt; dt\\\\=2022-06-01/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 2def &gt; dt\\\\=2022-06-02/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 3ghi &gt; dt\\\\=2022-06-03/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 4jkl &gt; dt\\\\=2022-06-04/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 5mno &gt; dt\\\\=2022-06-05/000000_0 \\n[root@ip-172-31-17-3 ~]# echo 6pqr &gt; dt\\\\=2022-06-06/000000_0 \\n</code></pre>\\n<p><strong>#将模拟数据分别存入hdfs1、hdfs2</strong></p>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# hdfs dfs -put dt\\\\=2022-06-0{1..3} hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\n[root@ip-172-31-17-3 ~]# hdfs dfs -mkdir -p hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\n[root@ip-172-31-17-3 ~]# hdfs dfs -put dt\\\\=2022-06-0{4..6} hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\n</code></pre>\\n<p><strong>#查询hdfs1和hdfs2,确认数据存入完成</strong></p>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# hdfs dfs -ls hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\nFound 3 items \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:09 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-01 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:09 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-02 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:09 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-03 \\n[root@ip-172-31-17-3 ~]# hdfs dfs -ls hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\nFound 3 items \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-04 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-05 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-06 \\n</code></pre>\\n<p><strong>#通过查询alluxio Union URI 再次确认数据存入hdfs1和hdfs2,以及Union URI跨存储关联生效</strong></p>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs ls /user/hive/test.db/test_part \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:09:19:243 DIR /user/hive/test.db/test_part/dt=2022-06-02 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:09:19:219 DIR /user/hive/test.db/test_part/dt=2022-06-01 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:10:49:740 DIR /user/hive/test.db/test_part/dt=2022-06-06 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:10:49:721 DIR /user/hive/test.db/test_part/dt=2022-06-05 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:10:49:698 DIR /user/hive/test.db/test_part/dt=2022-06-04 \\ndrwxr-xr-x root hdfsadmingroup 1 PERSISTED 07-13-2022 08:09:19:263 DIR /user/hive/test.db/test_part/dt=2022-06-03 \\n[root@ip-172-31-17-3 ~]#\\n</code></pre>\\n<p><strong>## Step 5: 刷新Hive表元数据</strong></p>\\n<pre><code class=\\"lang-\\">MSCK REPAIR TABLE test.test_part;\\nhive&gt; MSCK REPAIR TABLE test.test_part; \\nOK \\nPartitions not in metastore: test_part:dt=2022-06-01 test_part:dt=2022-06-02 test_part:dt=2022-06-03 test_part:dt=2022-06-04 test_part:dt=2022-06-05 test_part:dt=2022-06-06 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-01 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-02 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-03 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-04 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-05 \\nRepair: Added partition to metastore test.test_part:dt=2022-06-06 \\nTime taken: 1.677 seconds, Fetched: 7 row(s)\\n</code></pre>\\n<p><strong>#通过select方式观察到Hive元数据刷新后,alluxio union URI关联生效体现到Hive表中</strong></p>\\n<pre><code class=\\"lang-\\">hive&gt; select * from test.test_part; \\nOK \\n1abc 2022-06-01 \\n2def 2022-06-02 \\n3ghi 2022-06-03 \\n4jkl 2022-06-04 \\n5mno 2022-06-05 \\n6pqr 2022-06-06 \\nTime taken: 1.624 seconds, Fetched: 6 row(s) \\nhive&gt;\\n</code></pre>\\n<p><strong>## Step 6: 配置冷热自动分层策略</strong></p>\\n<pre><code class=\\"lang-\\">alluxio fs policy add /user/hive/test.db/test_part &quot;ufsMigrate(olderThan(2m), UFS[hdfs1]:REMOVE, UFS[hdfs2]:STORE)&quot; \\n</code></pre>\\n<p><strong>#设置策略:冷数据(本例中按生成超过2分钟的数据)自动从热存储(hdfs1)迁移到冷存储(hdfs2)</strong></p>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs policy add /user/hive/test.db/test_part &quot;ufsMigrate(olderThan(2m), UFS[hdfs1]:REMOVE, UFS[hdfs2]:STORE)&quot; \\nPolicy ufsMigrate-/user/hive/test.db/test_part is added to /user/hive/test.db/test_part. \\n</code></pre>\\n<p><strong>#通过Alluxio命令行查看策略设置成功与否</strong></p>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs policy list \\nid: 1657700423909 \\nname: &quot;ufsMigrate-/user/hive/test.db/test_part&quot; \\npath: &quot;/user/hive/test.db/test_part&quot; \\ncreated_at: 1657700423914 \\nscope: &quot;RECURSIVE&quot; \\ncondition: &quot;olderThan(2m)&quot; \\naction: &quot;DATA(UFS[hdfs1]:REMOVE, UFS[hdfs2]:STORE)&quot; \\n[root@ip-172-31-17-3 ~]#\\n</code></pre>\\n<p><strong>#策略生效后分别查看hdfs1和hdfs2,可以观察到hdfs1里面超过2分钟的数据都迁移到hdfs2中</strong></p>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 logs]# hdfs dfs -ls hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\n[root@ip-172-31-17-3 logs]# hdfs dfs -ls hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part \\nFound 6 items \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:26 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-01 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:26 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-02 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:26 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-03 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-04 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-05 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 08:10 hdfs://ip-172-31-19-127.us-west-2.compute.internal:8020/user/hive/test.db/test_part/dt=2022-06-06 \\n[root@ip-172-31-17-3 logs]#\\n</code></pre>\\n<p><strong>#策略生效,冷数据自动迁移过程中和完成后查Hive都得到如下预期查询结果:</strong></p>\\n<pre><code class=\\"lang-\\">hive&gt; select * from test.test_part; \\nOK \\n1abc 2022-06-01 \\n2def 2022-06-02 \\n3ghi 2022-06-03 \\n4jkl 2022-06-04 \\n5mno 2022-06-05 \\n6pqr 2022-06-06 \\nTime taken: 0.172 seconds, Fetched: 6 row(s) \\nhive&gt;\\n</code></pre>\\n<p>最后,我们将实验一的两个步骤:(1)通过Alluxio的Union URI实现跨两个HDFS存储系统的Hive表的数据联邦,和(2)通过Alluxio实现跨两个HDFS存储系统的透明数据冷热分层,在图1和图2中分别以简化示意图的方式展示,便于更好的理解实验目标、过程和结果。<br />\\n<img src=\\"https://dev-media.amazoncloud.cn/bc810fda42ed450aad4534675977872e_image.png\\" alt=\\"image.png\\" /></p>\n<p>图1:通过Alluxio的Union URI实现跨两个HDFS存储系统的Hive表的数据联邦的示意图<br />\\n<img src=\\"https://dev-media.amazoncloud.cn/b2e74fff7f6348c69cd0b3e23a5e4218_image.png\\" alt=\\"image.png\\" /><br />\\n图2:通过Alluxio实现跨两个HDFS存储系统的透明数据冷热分层示意图<br />\\n下一组实验只是将上一组实验设定中的两个HDFS存储系统更改成了两个异构存储系统HDFS(热存储)和Ozone(冷存储),从透明冷热分层功能层面效果是相同的。</p>\n<h1><a id=\\"AlluxioHDFSOzone_286\\"></a>实验二:基于Alluxio实现跨异构存储(HDFS和Ozone)的透明数据冷热分层</h1>\\n<h2><a id=\\"_step_1__hive__287\\"></a>## step 1 : hive 创建库、表</h2>\\n<pre><code class=\\"lang-\\">create database hdfsToOzone location '/user/hive/hdfsToOzone.db';\\ncreate external table hdfsToOzone.test(value string) partitioned by (dt string);\\n</code></pre>\\n<h2><a id=\\"_294\\"></a>#创建库</h2>\\n<pre><code class=\\"lang-\\">hive&gt; create database hdfsToOzone location '/user/hive/hdfsToOzone.db'; \\nOK \\nTime taken: 0.055 seconds \\nhive&gt;\\n</code></pre>\\n<h2><a id=\\"_303\\"></a>#创建表</h2>\\n<pre><code class=\\"lang-\\">hive&gt; create external table hdfsToOzone.test(value string) partitioned by (dt string); \\nOK \\nTime taken: 0.1 seconds \\nhive&gt;\\n</code></pre>\\n<h2><a id=\\"_step_2_Alluxio_Union_URIHDFSOzone_312\\"></a>## step 2: Alluxio Union URI实现跨HDFS/Ozone集群统一命名空间集成</h2>\\n<pre><code class=\\"lang-\\">alluxio fs mount \\\\\\n--option alluxio-union.hdfs.uri=hdfs://HDFS1:8020/user/hive/hdfsToOzone.db/test \\\\\\n--option alluxio-union.ozone.uri=o3fs://bucket.volume/hdfsToOzone.db/test \\\\\\n--option alluxio-union.priority.read=hdfs,ozone \\\\\\n--option alluxio-union.collection.create=hdfs \\\\\\n--option alluxio.underfs.hdfs.configuration=/mnt1/ozone-1.2.1/etc/hadoop/ozone-site.xml \\\\\\n/user/hive/hdfsToOzone.db/test union://HDFS_TO_OZONE/ \\n</code></pre>\\n<h2><a id=\\"Ozonevolumebucket_324\\"></a>#在Ozone中使用命令行工具创建volume、bucket</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-19-127 ~]# ozone sh volume create /v-alluxio \\n[root@ip-172-31-19-127 ~]# ozone sh bucket create /v-alluxio/b-alluxio \\n[root@ip-172-31-19-127 ~]# ozone fs -mkdir -p o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\n[root@ip-172-31-19-127 ~]# \\n</code></pre>\\n<h2><a id=\\"Alluxio_Union_URI__333\\"></a>#先在Alluxio中创建实验目录,然后以 Union URI 方式挂载目录</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs mkdir /user/hive/hdfsToOzone.db\\nSuccessfully created directory /user/hive/hdfsToOzone.db\\n[root@ip-172-31-17-3 ~]# alluxio fs mount \\\\ \\n&gt; --option alluxio-union.hdfs.uri=hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test \\\\ \\n&gt; --option alluxio-union.ozone.uri=o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\\\ \\n&gt; --option alluxio-union.priority.read=hdfs,ozone \\\\ \\n&gt; --option alluxio-union.collection.create=hdfs \\\\ \\n&gt; --option alluxio.underfs.hdfs.configuration=/mnt1/ozone-1.2.1/etc/hadoop/ozone-site.xml \\\\ \\n&gt; /user/hive/hdfsToOzone.db/test union://HDFS_TO_OZONE/ \\nMounted union://HDFS_TO_OZONE/ at /user/hive/hdfsToOzone.db/test \\n[root@ip-172-31-17-3 ~]#\\n</code></pre>\\n<h2><a id=\\"_step_3__Hive__Union_URI__349\\"></a>## step 3: 修改 Hive 表路径为 Union URI 路径,屏蔽跨异构存储的技术细节</h2>\\n<pre><code class=\\"lang-\\">alter table hdfsToOzone.test set location &quot;alluxio://alluxio:19998/user/hive/hdfsToOzone.db/test&quot;; \\n</code></pre>\\n<h2><a id=\\"Hive_355\\"></a>#修改Hive表格对应的路径</h2>\\n<pre><code class=\\"lang-\\">hive&gt; alter table hdfsToOzone.test set location &quot;alluxio://ip-172-31-17-3.us-west-2.compute.internal:19998/user/hive/hdfsToOzone.db/test&quot;; \\nOK \\nTime taken: 1.651 seconds \\nhive&gt; \\n</code></pre>\\n<h2><a id=\\"_step_4__364\\"></a>## step 4: 模拟数据</h2>\\n<pre><code class=\\"lang-\\">ozone fs -put dt\\\\=2022-06-0{1..3} o3fs://b-alluxio.v-alluxio.ozone:9862/hdfsToOzone.db/test \\nhdfs dfs -put dt\\\\=2022-06-0{4..6} hdfs://HDFS1:8020/user/hive/hdfsToOzone.db/test\\n</code></pre>\\n<h2><a id=\\"ozone_371\\"></a>#将数据存入ozone</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-19-127 ~]# ozone fs -put dt\\\\=2022-06-0{1..3} o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\n2022-07-13 10:00:38,920 [main] INFO impl.MetricsConfig: Loaded properties from hadoop-metrics2.properties \\n2022-07-13 10:00:38,981 [main] INFO impl.MetricsSystemImpl: Scheduled Metric snapshot period at 10 second(s). \\n2022-07-13 10:00:38,981 [main] INFO impl.MetricsSystemImpl: XceiverClientMetrics metrics system started \\n2022-07-13 10:00:39,198 [main] INFO metrics.MetricRegistries: Loaded MetricRegistries class org.apache.ratis.metrics.impl.MetricRegistriesImpl\\n</code></pre>\\n<h2><a id=\\"ozone_381\\"></a>#通过命令行查询ozone,确认数据存入完成</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-19-127 ~]# ozone fs -ls o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\nFound 3 items \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-01 \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-02 \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-03 \\n[root@ip-172-31-19-127 ~]#\\n</code></pre>\\n<h2><a id=\\"hdfs1hdfs1_392\\"></a>#将数据存入hdfs1,并通过命令行查询hdfs1,确认数据存入完成</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# hdfs dfs -put dt\\\\=2022-06-0{4..6} hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test \\n[root@ip-172-31-17-3 ~]# hdfs dfs -ls hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test \\nFound 3 items \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 10:06 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test/dt=2022-06-04 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 10:06 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test/dt=2022-06-05 \\ndrwxr-xr-x - root hdfsadmingroup 0 2022-07-13 10:06 hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test/dt=2022-06-06 \\n[root@ip-172-31-17-3 ~]#\\n</code></pre>\\n<h2><a id=\\"Alluxiohdfs1ozoneUnion_URI_404\\"></a>#通过Alluxio命令行查询,再次确认数据存入hdfs1和ozone,以及Union URI跨存储关联生效</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs ls /user/hive/hdfsToOzone.db/test \\ndrwxrwxrwx root root 0 PERSISTED 07-13-2022 10:00:40:670 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-02 \\ndrwxrwxrwx root root 0 PERSISTED 07-13-2022 10:00:38:691 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-01 \\ndrwxr-xr-x root hdfsadmingroup 0 PERSISTED 07-13-2022 10:06:29:206 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-06 \\ndrwxr-xr-x root hdfsadmingroup 0 PERSISTED 07-13-2022 10:06:29:186 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-05 \\ndrwxr-xr-x root hdfsadmingroup 0 PERSISTED 07-13-2022 10:06:29:161 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-04 \\ndrwxrwxrwx root root 0 PERSISTED 07-13-2022 10:00:40:762 DIR /user/hive/hdfsToOzone.db/test/dt=2022-06-03 \\n[root@ip-172-31-17-3 ~]# \\n\\n</code></pre>\\n<h2><a id=\\"_step_5_Hive_417\\"></a>## step 5: 刷新Hive表元数据</h2>\\n<pre><code class=\\"lang-\\">MSCK REPAIR TABLE hdfsToOzone.test;\\nhive&gt; MSCK REPAIR TABLE hdfsToOzone.test; \\nOK \\nPartitions not in metastore: test:dt=2022-06-01 test:dt=2022-06-02 test:dt=2022-06-03 test:dt=2022-06-04 test:dt=2022-06-05 test:dt=2022-06-06 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-01 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-02 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-03 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-04 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-05 \\nRepair: Added partition to metastore hdfsToOzone.test:dt=2022-06-06 \\nTime taken: 0.641 seconds, Fetched: 7 row(s) \\nhive&gt;\\n</code></pre>\\n<h2><a id=\\"selecthivealluxio_union_URIhive_434\\"></a>#通过select方式观察到hive元数据刷新后,alluxio union URI关联生效体现到hive表中</h2>\\n<pre><code class=\\"lang-\\">hive&gt; select * from hdfsToOzone.test ; \\nOK \\n1abc 2022-06-01 \\n2def 2022-06-02 \\n3ghi 2022-06-03 \\n4jkl 2022-06-04 \\n5mno 2022-06-05 \\n6pqr 2022-06-06 \\nTime taken: 0.156 seconds, Fetched: 6 row(s) \\nhive&gt;\\n</code></pre>\\n<h2><a id=\\"_step_6__449\\"></a>## step 6: 配置策略</h2>\\n<pre><code class=\\"lang-\\">alluxio fs policy add /user/hive/hdfsToOzone.db/test&quot; ufsMigrate(olderThan(2m), UFS[hdfs]:REMOVE, UFS[ozone]:STORE)&quot; \\n</code></pre>\\n<h2><a id=\\"2hdfs1ozone_455\\"></a>#设置策略:冷数据(本例中按生成超过2分钟的数据)自动从热存储(hdfs1)迁移到冷存储(ozone)</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs policy add /user/hive/hdfsToOzone.db/test/ &quot;ufsMigrate(olderThan(2m), UFS[hdfs]:REMOVE, UFS[ozone]:STORE)&quot; \\nPolicy ufsMigrate-/user/hive/hdfsToOzone.db/test is added to /user/hive/hdfsToOzone.db/test.\\n</code></pre>\\n<h2><a id=\\"Alluxio_462\\"></a>#通过Alluxio命令行查看策略设置成功与否</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs policy list \\nid: 1657707130843 \\nname: &quot;ufsMigrate-/user/hive/hdfsToOzone.db/test&quot; \\npath: &quot;/user/hive/hdfsToOzone.db/test&quot; \\ncreated_at: 1657707130843 \\nscope: &quot;RECURSIVE&quot; \\ncondition: &quot;olderThan(2m)&quot; \\naction: &quot;DATA(UFS[hdfs]:REMOVE, UFS[ozone]:STORE)&quot; \\n[root@ip-172-31-17-3 ~]# \\n</code></pre>\\n<h2><a id=\\"hdfs1ozonehdfs12ozone_476\\"></a>#策略生效后分别查看hdfs1和ozone,可以观察到hdfs1里面超过2分钟的数据都迁移到ozone中</h2>\\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# ozone fs -ls o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test \\nFound 6 items \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-01 \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-02 \\ndrwxrwxrwx - root root 0 2022-07-13 10:00 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-03 \\ndrwxrwxrwx - root root 0 2022-07-13 10:21 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-04 \\ndrwxrwxrwx - root root 0 2022-07-13 10:21 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-05 \\ndrwxrwxrwx - root root 0 2022-07-13 10:21 o3fs://b-alluxio.v-alluxio/hdfsToOzone.db/test/dt=2022-06-06 \\n[root@ip-172-31-17-3 ~]# hdfs dfs -ls hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/user/hive/hdfsToOzone.db/test \\n[root@ip-172-31-17-3 ~]# \\n</code></pre>\\n<h2><a id=\\"hive_491\\"></a>#策略生效,冷数据自动迁移过程中和完成后查hive都得到如下预期查询结果:</h2>\\n<pre><code class=\\"lang-\\">hive&gt; select * from hdfsToOzone.test ; \\nOK \\n1abc 2022-06-01 \\n2def 2022-06-02 \\n3ghi 2022-06-03 \\n4jkl 2022-06-04 \\n5mno 2022-06-05 \\n6pqr 2022-06-06 \\nTime taken: 0.144 seconds, Fetched: 6 row(s) \\nhive&gt; \\n</code></pre>\\n<h2><a id=\\"4__506\\"></a>4. 实验小结</h2>\\n<p>可以看出,实验二的执行过程和效果展示和实验一几乎是如出一辙,除了冷数据存储系统从hdfs2切换成了一个异构存储系统Ozone。</p>\n<p>通过实验,我们充分验证了Alluxio数据编排是如何成功将上层应用 (比如基于Hive的数仓建设) 与底层数据持久化策略 (使用hdfs或者Ozone, 是否进行冷热分层等) 解耦合的。同时也体现了Alluxio对于异构存储系统的通用性和易用性。</p>\n<p>最后希望这篇文章对各位如何使用Alluxio经济化数据存储策略有所启迪。</p>\n<h1><a id=\\"_513\\"></a>附录</h1>\\n<h2><a id=\\"AlluxioHiveHDFS_514\\"></a>Alluxio集成Hive及HDFS的方式</h2>\\n<p>Alluxio 配置</p>\n<blockquote>\\n<p>echo ‘export ALLX_HOME=/mnt1/alluxio’ &gt;&gt; ~/.bashrc<br />\\necho ‘export PATH=<span class=\\"katex\\"><span class=\\"katex-mathml\\"><math><semantics><mrow><mi>P</mi><mi>A</mi><mi>T</mi><mi>H</mi><mo>:</mo></mrow><annotation encoding=\\"application/x-tex\\">PATH:</annotation></semantics></math></span><span class=\\"katex-html\\" aria-hidden=\\"true\\"><span class=\\"strut\\" style=\\"height:0.68333em;\\"></span><span class=\\"strut bottom\\" style=\\"height:0.68333em;vertical-align:0em;\\"></span><span class=\\"base\\"><span class=\\"mord mathit\\" style=\\"margin-right:0.13889em;\\">P</span><span class=\\"mord mathit\\">A</span><span class=\\"mord mathit\\" style=\\"margin-right:0.13889em;\\">T</span><span class=\\"mord mathit\\" style=\\"margin-right:0.08125em;\\">H</span><span class=\\"mrel\\">:</span></span></span></span>ALLX_HOME/bin’ &gt;&gt; ~/.bashrc</p>\n</blockquote>\\n<pre><code class=\\"lang-\\">alluxio.master.hostname=ip-172-31-17-3.us-west-2.compute.internal \\nalluxio.underfs.address=hdfs://ip-172-31-30-130.us-west-2.compute.internal:8020/alluxio \\nalluxio.worker.tieredstore.level0.dirs.path=/alluxio/ramdisk\\n\\nalluxio.worker.memory.size=4G\\nalluxio.worker.tieredstore.levels=1\\nalluxio.worker.tieredstore.level0.alias=MEM\\nalluxio.user.file.readtype.default=CACHE\\nalluxio.user.file.writetype.default=ASYNC_THROUGH\\nalluxio.security.login.impersonation.username=_HDFS_USER_\\nalluxio.master.security.impersonation.yarn.groups=*\\nalluxio.master.security.impersonation.hive.groups=*\\nalluxio.user.metrics.collection.enabled=true\\nalluxio.user.block.size.bytes.default=64MB\\n\\n######## Explore ########\\nalluxio.user.block.write.location.policy.class=alluxio.client.block.policy.DeterministicHashPolicy\\nalluxio.user.ufs.block.read.location.policy=alluxio.client.block.policy.DeterministicHashPolicy\\nalluxio.user.ufs.block.read.location.policy.deterministic.hash.shards=1\\nalluxio.user.file.persist.on.rename=true\\nalluxio.master.persistence.blacklist=.staging,_temporary,.tmp\\nalluxio.user.file.passive.cache.enabled=false \\n</code></pre>\\n<p>Hive 客户端core-site.xml</p>\n<blockquote>\\n<p>cp /hadoop_home/etc/hadoop/core-site.xml /hive_home/conf</p>\n</blockquote>\\n<h2><a id=\\"_jarhadoophive_homelib_547\\"></a>拷贝 jar分别到hadoop和hive home下的lib子目录中</h2>\\n<pre><code class=\\"lang-\\">cp /&lt;PATH_TO_ALLUXIO&gt;/client/alluxio-enterprise-2.8.0-1.0-client.jar /hadoop_home/share/lib \\ncp /&lt;PATH_TO_ALLUXIO&gt;/client/alluxio-enterprise-2.8.0-1.0-client.jar /hive_home/lib\\n</code></pre>\\n<h2><a id=\\"alluxio_554\\"></a>配置alluxio文件系统</h2>\\n<pre><code class=\\"lang-\\">vim /hive_home/conf/core-site.xml \\n&lt;property&gt;\\n &lt;name&gt;fs.alluxio.impl&lt;/name&gt;\\n &lt;value&gt;alluxio.hadoop.FileSystem&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n &lt;name&gt;alluxio.master.rpc.addresses&lt;/name&gt;\\n &lt;value&gt;ip-172-31-17-3.us-west-2.compute.internal:19998&lt;/value&gt;\\n&lt;/property&gt; \\n</code></pre>\\n<p>HDFS授权</p>\n<h2><a id=\\"hdfs__570\\"></a>查看hdfs 超级用户</h2>\\n<pre><code class=\\"lang-\\">vim /hadoop_home/etc/hadoop/hdfs-site.xml\\n&lt;property&gt;\\n&lt;name&gt;dfs.permissions.superusergroup&lt;/name&gt;\\n&lt;value&gt;hdfsadmingroup&lt;/value&gt;\\n&lt;/property&gt;\\n</code></pre>\\n<h2><a id=\\"_Alluxio_supergroup_580\\"></a>将用户 Alluxio 增加到supergroup</h2>\\n<pre><code class=\\"lang-\\">groupadd hdfsadmingroup\\nusermod -a -G hdfsadmingroup root\\n</code></pre>\\n<h2><a id=\\"_HDFS_587\\"></a>同步系统的权限信息到 HDFS</h2>\\n<pre><code class=\\"lang-\\">su - hdfs -s /bin/bash -c &quot;hdfs dfsadmin -refreshUserToGroupsMappings&quot;\\n</code></pre>\\n<h2><a id=\\"hdfs_acl_593\\"></a>开启hdfs acl</h2>\\n<pre><code class=\\"lang-\\">vim /hadoop_home/etc/hadoop/hdfs-site.xml\\n&lt;property&gt;\\n&lt;name&gt;dfs.permissions.enabled&lt;/name&gt;\\n&lt;value&gt;true&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;dfs.namenode.acls.enabled&lt;/name&gt;\\n&lt;value&gt;true&lt;/value&gt;\\n&lt;/property&gt; \\nsu - hdfs -s /bin/bash -c &quot;hdfs dfs -setfacl -R -m user:root:rwx /&quot;\\n</code></pre>\\n<h2><a id=\\"Ozone__608\\"></a>Ozone 部署</h2>\\n<p>配置文件</p>\n<pre><code class=\\"lang-\\">wget https://dlcdn.apache.org/ozone/1.2.1/ozone-1.2.1.tar.gz \\necho 'export OZONE_HOME=/mnt1/ozone-1.2.1' &gt;&gt; ~/.bashrc\\necho 'export PATH=\$PATH:\$OZONE_HOME/bin:\$OZONE_HOME/sbin' &gt;&gt; ~/.bashrc\\n</code></pre>\\n<p>##在ozone-site.xml中加入必要配置信息</p>\n<pre><code class=\\"lang-\\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;\\n&lt;configuration&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.om.address&lt;/name&gt;\\n&lt;value&gt;ip-172-31-19-127.us-west-2.compute.internal:9862&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.metadata.dirs&lt;/name&gt;\\n&lt;value&gt;/mnt/ozone-1.2.1/metadata/ozone&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.scm.client.address&lt;/name&gt;\\n&lt;value&gt;ip-172-31-19-127.us-west-2.compute.internal:9860&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.scm.names&lt;/name&gt;\\n&lt;value&gt;ip-172-31-19-127.us-west-2.compute.internal&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.scm.datanode.id.dir&lt;/name&gt;\\n&lt;value&gt;/mnt/ozone-1.2.1/metadata/ozone/node&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.om.db.dirs&lt;/name&gt;\\n&lt;value&gt;/mnt/ozone-1.2.1/metadata/ozone/omdb&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.scm.db.dirs&lt;/name&gt;\\n&lt;value&gt;/mnt/ozone-1.2.1/metadata/ozone/scmdb&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;hdds.datanode.dir&lt;/name&gt;\\n&lt;value&gt;/mnt/ozone-1.2.1/datanode/data&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.om.ratis.enable&lt;/name&gt;\\n&lt;value&gt;false&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.om.http-address&lt;/name&gt;\\n&lt;value&gt;ip-172-31-19-127.us-west-2.compute.internal:9874&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.s3g.domain.name&lt;/name&gt;\\n&lt;value&gt;s3g.internal&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;property&gt;\\n&lt;name&gt;ozone.replication&lt;/name&gt;\\n&lt;value&gt;1&lt;/value&gt;\\n&lt;/property&gt;\\n&lt;/configuration&gt; \\n</code></pre>\\n<p>初始化与启动(按照顺序)</p>\n<pre><code class=\\"lang-\\">ozone scm --init\\nozone --daemon start scm\\nozone om --init\\nozone --daemon start om \\nozone --daemon start datanode\\nozone --daemon start s3g \\nozone使用操作\\n</code></pre>\\n<p>#创建名称为v-alluxio的volume</p>\n<pre><code class=\\"lang-\\">[root@ip-172-31-19-127 ~]# ozone sh volume create /v-alluxio \\n[root@ip-172-31-19-127 ~]#\\n</code></pre>\\n<p>#在v-alluxio下创建名为b-alluxio的bucket</p>\n<pre><code class=\\"lang-\\">[root@ip-172-31-19-127 ~]# ozone sh bucket create /v-alluxio/b-alluxio \\n[root@ip-172-31-19-127 ~]#\\n</code></pre>\\n<p>#查看bucket的相关信息</p>\n<pre><code class=\\"lang-\\">[root@ip-172-31-19-127 ~]# ozone sh bucket info /v-alluxio/b-alluxio \\n{ \\n &quot;metadata&quot; : { }, \\n &quot;volumeName&quot; : &quot;v-alluxio&quot;, \\n &quot;name&quot; : &quot;b-alluxio&quot;, \\n &quot;storageType&quot; : &quot;DISK&quot;, \\n &quot;versioning&quot; : false, \\n &quot;usedBytes&quot; : 30, \\n &quot;usedNamespace&quot; : 6, \\n &quot;creationTime&quot; : &quot;2022-07-13T09:11:37.403Z&quot;, \\n &quot;modificationTime&quot; : &quot;2022-07-13T09:11:37.403Z&quot;, \\n &quot;quotaInBytes&quot; : -1, \\n &quot;quotaInNamespace&quot; : -1, \\n &quot;bucketLayout&quot; : &quot;LEGACY&quot; \\n} \\n[root@ip-172-31-19-127 ~]#\\n#创建key,并放入相应的内容\\n\\n[root@ip-172-31-19-127 ~]# touch Dockerfile \\n[root@ip-172-31-19-127 ~]# ozone sh key put /v-alluxio/b-alluxio/Dockerfile Dockerfile \\n[root@ip-172-31-19-127 ~]#\\n#列出bucket下所有的key\\n\\n[root@ip-172-31-19-127 ~]# ozone sh key list /v-alluxio/b-alluxio/\\n{ \\n &quot;volumeName&quot; : &quot;v-alluxio&quot;, \\n &quot;bucketName&quot; : &quot;b-alluxio&quot;, \\n &quot;name&quot; : &quot;Dockerfile&quot;, \\n &quot;dataSize&quot; : 0, \\n &quot;creationTime&quot; : &quot;2022-07-13T14:37:09.761Z&quot;, \\n &quot;modificationTime&quot; : &quot;2022-07-13T14:37:09.801Z&quot;, \\n &quot;replicationConfig&quot; : { \\n &quot;replicationFactor&quot; : &quot;ONE&quot;, \\n &quot;requiredNodes&quot; : 1, \\n &quot;replicationType&quot; : &quot;RATIS&quot; \\n }, \\n &quot;replicationFactor&quot; : 1, \\n &quot;replicationType&quot; : &quot;RATIS&quot; \\n}\\n[root@ip-172-31-19-127 ~]#\\n</code></pre>\\n<p>#查看key的相关信息</p>\n<pre><code class=\\"lang-\\">[root@ip-172-31-19-127 ~]# ozone sh key info /v-alluxio/b-alluxio/Dockerfile \\n{ \\n &quot;volumeName&quot; : &quot;v-alluxio&quot;, \\n &quot;bucketName&quot; : &quot;b-alluxio&quot;, \\n &quot;name&quot; : &quot;Dockerfile&quot;, \\n &quot;dataSize&quot; : 0, \\n &quot;creationTime&quot; : &quot;2022-07-13T14:37:09.761Z&quot;, \\n &quot;modificationTime&quot; : &quot;2022-07-13T14:37:09.801Z&quot;, \\n &quot;replicationConfig&quot; : { \\n &quot;replicationFactor&quot; : &quot;ONE&quot;, \\n &quot;requiredNodes&quot; : 1, \\n &quot;replicationType&quot; : &quot;RATIS&quot; \\n }, \\n &quot;ozoneKeyLocations&quot; : [ ], \\n &quot;metadata&quot; : { }, \\n &quot;replicationFactor&quot; : 1, \\n &quot;replicationType&quot; : &quot;RATIS&quot; \\n} \\n[root@ip-172-31-19-127 ~]#\\n\\n</code></pre>\\n<p>Alluxio 挂载 ozone</p>\n<p>#方式一</p>\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs mount /ozone o3fs://b-alluxio.v-alluxio.ip-172-31-19-127.us-west-2.compute.internal:9862/ \\nMounted o3fs://b-alluxio.v-alluxio.ip-172-31-19-127.us-west-2.compute.internal:9862/ at /ozone \\n[root@ip-172-31-17-3 ~]#\\n</code></pre>\\n<p>#方式二(带option的mount)</p>\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs mount \\\\ \\n&gt; --option alluxio.underfs.hdfs.configuration=/mnt1/ozone-1.2.1/etc/hadoop/ozone-site.xml \\\\ \\n&gt; /ozone1 o3fs://b-alluxio.v-alluxio/ \\nMounted o3fs://b-alluxio.v-alluxio/ at /ozone1 \\n[root@ip-172-31-17-3 ~]# \\n</code></pre>\\n<p>#验证Ozone挂载是否成功</p>\n<pre><code class=\\"lang-\\">[root@ip-172-31-17-3 ~]# alluxio fs ls / \\ndrwxrwxrwx root root 0 PERSISTED 01-01-1970 00:00:00:000 DIR /ozone1 \\ndrwxrwxrwx root root 0 PERSISTED 01-01-1970 00:00:00:000 DIR /ozone \\n[root@ip-172-31-17-3 ~]#\\n</code></pre>\n"}
目录
亚马逊云科技解决方案 基于行业客户应用场景及技术领域的解决方案
联系亚马逊云科技专家
亚马逊云科技解决方案
基于行业客户应用场景及技术领域的解决方案
联系专家
0
目录
关闭