下面是一个使用 shell 脚本从一张 HBase 表中遍历另一张表数据的示例:
#!/bin/bash
# 获取遍历字段
field=$(hbase shell << EOF
get 'table1', 'row1', 'cf1:field1'
EOF
)
# 从第二张表中遍历数据
results=$(hbase shell << EOF
scan 'table2', {COLUMNS => 'cf2:field2', FILTER => "ValueFilter(=, 'binary:$field')"}
EOF
)
# 输出结果
echo "$results"