问题:
为cdh新增节点时,在分配datanode后,启动报错
Can't open /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/config.zip: 权限不够. Can't open /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/proc.json: 权限不够.
Can't open /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/config.zip,Permission deny
Can't open /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/proc.zip,Permission deny
以为是权限问题,chmod -R 777 /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process,重启后生成新的文件夹,权限还是有问题,推测是启动过程中root用去创建了,接着hdfs去读这个文件,所以报错
解决:
当重启时,此处将进程挂起3分钟,手动用root用户将/youdir/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process目录改为777,然后,没有然后,只需等待,3分钟后,居然就成功了,成功了。
/youdir/opt/cloudera-manager/cm-5.11.2/lib64/cmf/service/common/cloudera-config.sh
# When created, the final resting place of config files is unknown, # so it is marked as {{CMF_CONF_DIR}}. We know what this directory will # be here in this script, so search-replace it. replace_conf_dir() { echo "CONF_DIR=$CONF_DIR" echo "CMF_CONF_DIR=$CMF_CONF_DIR" ############fix the Can't open /youdir/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/config.zip, ################### ############fix the Can't open /youdir/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/proc.json ################### sleep 3m; ############fix end############################# # Exclude files that we don't want to be modified. (OPSAPS-37023) EXCLUDE_CMF_FILES=('cloudera-config.sh' 'httpfs.sh' 'hue.sh' 'impala.sh' 'sqoop.sh' 'supervisor.conf' '*.log' '*.keytab' '*jceks') find $CONF_DIR -type f ! -path "$CONF_DIR/logs/*" $(printf "! -name %s " ${EXCLUDE_CMF_FILES[@]}) -exec perl -pi -e "s#{{CMF_CONF_DIR}}#$CONF_DIR#g" {} ; }
分析:
在日志中
中发现在find命令后,报错,那就在find命令前将进程挂起,修改目录权限,待执行find时,权限已符合要求
+ EXCLUDE_CMF_FILES=('cloudera-config.sh' 'httpfs.sh' 'hue.sh' 'impala.sh' 'sqoop.sh' 'supervisor.conf' '*.log' '*.keytab' '*jceks') ++ printf '! -name %s ' cloudera-config.sh httpfs.sh hue.sh impala.sh sqoop.sh supervisor.conf '*.log' hdfs.keytab '*jceks' + find /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE -type f '!' -path '/software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/logs/*' '!' -name cloudera-config.sh '!' -name httpfs.sh '!' -name hue.sh '!' -name impala.sh '!' -name sqoop.sh '!' -name supervisor.conf '!' -name '*.log' '!' -name hdfs.keytab '!' -name '*jceks' -exec perl -pi -e 's#{{CMF_CONF_DIR}}#/software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE#g' '{}' ';' Can't open /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/config.zip: 权限不够. Can't open /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE/proc.json: 权限不够. + make_scripts_executable + find /software/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agent/process/642-hdfs-DATANODE -regex '.*.(py|sh)$' -exec chmod u+x '{}' ';' + '[' DATANODE_MAX_LOCKED_MEMORY '!=' '' ']' + ulimit -l
参考文章:https://blog.csdn.net/u011120550/article/details/80598653