当前位置:   article > 正文

ES脚本启动报错修改

ES脚本启动报错修改

使用自写脚本启动ES集群时,添加安全策略时报错如下:

Positional arguments not allowed, found [ -E xpack.security.enabled=true -E xpack.security.transport.ssl.enabled=true -E xpack.license.self_generated.type=basic -E xpack.security.transport.ssl.keystore.path=certs/elastic-certificates.p12 -E xpack.security.transport.ssl.truststore.path=certs/elastic-certificates.p12 -E xpack.security.transport.ssl.verification_mode=certificate]

  1. if [[ $1 == 'security' ]]; then
  2. echo '使用安全集群'
  3. shift 1
  4. ES_OPT=$@
  5. ES_OPT="$ES_OPT -E xpack.security.enabled=true -E xpack.security.transport.ssl.enabled=true -E xpack.license.self_generated.type=basic -E xpack.security.transport.ssl.keystore.path=certs/elastic-certificates.p12 -E xpack.security.transport.ssl.truststore.path=certs/elastic-certificates.p12 -E xpack.security.transport.ssl.verification_mode=certificate"
  6. fi
  7. cd $ES_HOME
  8. for (( i = 0; i < $num; i++ )); do
  9. echo "尝试启动第`expr $i + 1`个ES节点"
  10. bin/elasticsearch -E node.name=node$i -E cluster.name=cluster -E path.data=node${i}_data $ES_OPT -d
  11. done

最后发现$ES_OPT为字符串处理,修改为数组处理

  1. if [[ $1 == 'security' ]]; then
  2. echo '使用安全集群'
  3. shift 1
  4. ES_OPT=$@
  5. ES_OPT=($ES_OPT[@] -Expack.security.enabled=true -Expack.security.transport.ssl.enabled=true -Expack.license.self_generated.type=basic -Expack.security.transport.ssl.keystore.path=certs/elastic-certificates.p12 -Expack.security.transport.ssl.truststore.path=certs/elastic-certificates.p12 -Expack.security.transport.ssl.verification_mode=certificate)
  6. fi
  7. cd $ES_HOME
  8. for (( i = 0; i < $num; i++ )); do
  9. echo "尝试启动第`expr $i + 1`个ES节点"
  10. bin/elasticsearch -E node.name=node$i -E cluster.name=cluster -E path.data=node${i}_data $ES_OPT -d
  11. done
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/656465
推荐阅读
相关标签
  

闽ICP备14008679号