更新:
我们将 resize_env.sh 添加到了基础 bdutil repo,所以你不需要再去我的 fork 了
原答案:
目前还没有官方支持调整 bdutil 部署的集群的大小,但这肯定是我们之前讨论过的内容,实际上整合一些调整大小的基本支持是相当可行的。一旦合并到主分支中,这可能会采用不同的形式,但我已将调整大小支持的初稿推送到 my fork of bdutil。这是在两个提交中实现的;一个允许skipping all "master" operations(包括创建、运行命令、删除等),另一个允许add the resize_env.sh file。
我还没有针对其他 bdutil 扩展的所有组合对其进行测试,但我至少已经成功地使用基本 bdutil_env.sh 和 extensions/spark/spark_env.sh 运行它。从理论上讲,它也应该适用于您的 bigquery 和数据存储扩展。要在您的情况下使用它:
# Assuming you initially deployed with this command (default n == 2)
./bdutil -e bigquery_env.sh,datastore_env.sh,extensions/spark/spark_env.sh -b myhdfsbucket -n 2 deploy
# Before this step, edit resize_env.sh and set NEW_NUM_WORKERS to what you want.
# Currently it defaults to 5.
# Deploy only the new workers, e.g. {hadoop-w-2, hadoop-w-3, hadoop-w-4}:
./bdutil -e bigquery_env.sh,datastore_env.sh,extensions/spark/spark_env.sh -b myhdfsbucket -n 2 -e resize_env.sh deploy
# Explicitly start the Hadoop daemons on just the new workers:
./bdutil -e bigquery_env.sh,datastore_env.sh,extensions/spark/spark_env.sh -b myhdfsbucket -n 2 -e resize_env.sh run_command -t workers -- "service hadoop-hdfs-datanode start && service hadoop-mapreduce-tasktracker start"
# If using Spark as well, explicitly start the Spark daemons on the new workers:
./bdutil -e bigquery_env.sh,datastore_env.sh,extensions/spark/spark_env.sh -b myhdfsbucket -n 2 -e resize_env.sh run_command -t workers -u extensions/spark/start_single_spark_worker.sh -- "./start_single_spark_worker.sh"
# From now on, it's as if you originally turned up your cluster with "-n 5".
# When deleting, remember to include those extra workers:
./bdutil -b myhdfsbucket -n 5 delete
一般来说,最佳实践建议是将您的配置压缩到一个文件中,而不是总是传递标志。例如,在您的情况下,您可能需要一个名为 my_base_env.sh 的文件:
import_env bigquery_env.sh
import_env datastore_env.sh
import_env extensions/spark/spark_env.sh
NUM_WORKERS=2
CONFIGBUCKET=myhdfsbucket
然后调整大小的命令要短得多:
# Assuming you initially deployed with this command (default n == 2)
./bdutil -e my_base_env.sh deploy
# Before this step, edit resize_env.sh and set NEW_NUM_WORKERS to what you want.
# Currently it defaults to 5.
# Deploy only the new workers, e.g. {hadoop-w-2, hadoop-w-3, hadoop-w-4}:
./bdutil -e my_base_env.sh -e resize_env.sh deploy
# Explicitly start the Hadoop daemons on just the new workers:
./bdutil -e my_base_env.sh -e resize_env.sh run_command -t workers -- "service hadoop-hdfs-datanode start && service hadoop-mapreduce-tasktracker start"
# If using Spark as well, explicitly start the Spark daemons on the new workers:
./bdutil -e my_base_env.sh -e resize_env.sh run_command -t workers -u extensions/spark/start_single_spark_worker.sh -- "./start_single_spark_worker.sh"
# From now on, it's as if you originally turned up your cluster with "-n 5".
# When deleting, remember to include those extra workers:
./bdutil -b myhdfsbucket -n 5 delete
最后,这与您最初使用-n 5 部署集群的情况并非100% 相同;在这种情况下,您的主节点 /home/hadoop/hadoop-install/conf/slaves 和 /home/hadoop/spark-install/conf/slaves 上的文件将丢失您的新节点。如果您打算使用 /home/hadoop/hadoop-install/bin/[stop|start]-all.sh 或 /home/hadoop/spark-install/sbin/[stop|start]-all.sh,您可以手动 SSH 到您的主节点并编辑这些文件以将您的新节点添加到列表中;如果没有,则无需更改那些从属文件。