gpt4 book ai didi

用于执行 hbase 命令的 Shell 脚本 - 删除所有 hbase 表

转载 作者:行者123 更新时间:2023-12-04 16:25:47 27 4
gpt4 key购买 nike

我想删除 HBase 中的所有表。我正在使用 HBase shell 命令来执行此操作:

$ hbase shell
> disable_all .*
> drop_all .*

如何编写用于执行此操作的 shell 脚本?

注意:在执行上述命令时,它会在禁用和删除所有表之前要求用户确认,即 y/n。

最佳答案

我使用以下内容:

#!/bin/sh
echo -e "disable_all '.*'\ny" | hbase shell -n
echo -e "drop_all '.*'\ny" | hbase shell -n
-e标志回显导致它处理转义序列,因此您可以将确认构建到其中。 -n告诉 hbase shell 这是一个非交互式 session 。

关于用于执行 hbase 命令的 Shell 脚本 - 删除所有 hbase 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31126292/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com