今天尝试用 ansible 管理集群,结果启动碰到问题,如下:
➜ ~ ansible all -m shell -a "/bin/bash /home/elasticsearch/elasticsearch-5.5.0/bin/elasticsearch -d" -u elasticsearch 192.168.200.138 | FAILED | rc=1 >> Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME
192.168.200.139 | FAILED | rc=1 >> Elasticsearch requires at least Java 8 but your Java version from /usr/bin/java does not meet this requirement
192.168.200.140 | FAILED | rc=1 >> Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME
在集群的机器上运行 /bin/bash /home/elasticsearch/elasticsearch-5.5.0/bin/elasticsearch -d 是没有问题的,简单的就“./bin/elasticsearch -d ”就可以启动了,但是用 ansible 就会报 java 的错误,有大神可以解决吗?
1
Reloading 2017-08-23 15:08:15 +08:00
写的很清楚了 没有 JAVA_HOME,你在 elasticsearch 里添加个 JAVA_HOME
|
2
laxenade 2017-08-23 15:19:10 +08:00
环境变量需要传进 shell command 里
``` - name: xxx shell: yyy environment: zzz ``` |
4
hagezhou OP @laxenade 弱弱的问一句
- hosts: 192.168.200.138 remote_user: elasticsearch tasks: - name: run es command: ./elasticsearch-5.5.0/bin/elasticsearch -d environment: PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/java8/bin:/opt/cloudera/parcels/CDH/lib/hadoop/../../bin:/opt/apache-maven-3.3.9/bin" JAVA_HOME: "/opt/java8/bin/java" es 启动加上-d 之后 ansible 表示执行成功,但是去集群上看 ps 一下 es 并没有起来 如果去掉-d 之后就变成前台了,ansible 会阻塞,es 起来了,这是为什么?能不能搞成后台的 |
5
laxenade 2017-08-24 01:00:57 +08:00 via Android
|