赞
踩
使用自写脚本启动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]
- if [[ $1 == 'security' ]]; then
- echo '使用安全集群'
- shift 1
- ES_OPT=$@
- 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"
- fi
-
- cd $ES_HOME
- for (( i = 0; i < $num; i++ )); do
- echo "尝试启动第`expr $i + 1`个ES节点"
- bin/elasticsearch -E node.name=node$i -E cluster.name=cluster -E path.data=node${i}_data $ES_OPT -d
- done
-
最后发现$ES_OPT为字符串处理,修改为数组处理
- if [[ $1 == 'security' ]]; then
- echo '使用安全集群'
- shift 1
- ES_OPT=$@
- 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)
- fi
-
- cd $ES_HOME
- for (( i = 0; i < $num; i++ )); do
- echo "尝试启动第`expr $i + 1`个ES节点"
- bin/elasticsearch -E node.name=node$i -E cluster.name=cluster -E path.data=node${i}_data $ES_OPT -d
- done
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。