andrewrothstein / ansible-zookeeper-cluster

MIT License
10 stars 12 forks source link

/usr/local/zookeeper/bin/zkServer.sh: line 170: exec: java: not found #7

Closed patsevanton closed 4 years ago

patsevanton commented 4 years ago

Hello! Thanks for role.

CentOS 7

Apr 18 06:45:21 zookeper-1.novalocal systemd[1]: Stopped Apache Zookeeper.
Apr 18 06:45:21 zookeper-1.novalocal systemd[1]: Started Apache Zookeeper.
Apr 18 06:45:21 zookeper-1.novalocal zkServer.sh[14726]: ZooKeeper JMX enabled by default
Apr 18 06:45:21 zookeper-1.novalocal zkServer.sh[14726]: Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Apr 18 06:45:21 zookeper-1.novalocal zkServer.sh[14726]: /usr/local/zookeeper/bin/zkServer.sh: line 170: exec: java: not found
Apr 18 06:45:21 zookeper-1.novalocal systemd[1]: zookeeper.service: main process exited, code=exited, status=127/n/a
Apr 18 06:45:21 zookeper-1.novalocal systemd[1]: Unit zookeeper.service entered failed state.
Apr 18 06:45:21 zookeper-1.novalocal systemd[1]: zookeeper.service failed.
Apr 18 06:45:22 zookeper-1.novalocal systemd[1]: zookeeper.service holdoff time over, scheduling restart.
Apr 18 06:45:22 zookeper-1.novalocal systemd[1]: Stopped Apache Zookeeper.
Apr 18 06:45:22 zookeper-1.novalocal systemd[1]: start request repeated too quickly for zookeeper.service
Apr 18 06:45:22 zookeper-1.novalocal systemd[1]: Failed to start Apache Zookeeper.
Apr 18 06:45:22 zookeper-1.novalocal systemd[1]: Unit zookeeper.service entered failed state.
Apr 18 06:45:22 zookeper-1.novalocal systemd[1]: zookeeper.service failed.

log install


[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will change, 
but still be user configurable on deprecation. This feature will be removed in version 2.10. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [zookeeper] *******************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************
ok: [172.26.10.16]
ok: [172.26.10.18]
ok: [172.26.10.17]

TASK [andrewrothstein.unarchive-deps : resolve platform specific vars] *************************************************************************
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12. Deprecation warnings can be disabled 
by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12. Deprecation warnings can be disabled 
by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12. Deprecation warnings can be disabled 
by setting deprecation_warnings=False in ansible.cfg.

TASK [andrewrothstein.unarchive-deps : install common pkgs...] *********************************************************************************
changed: [172.26.10.16]
changed: [172.26.10.18]
changed: [172.26.10.17]

TASK [andrewrothstein.alpine-glibc-shim : fix alpine] ******************************************************************************************
skipping: [172.26.10.16]
skipping: [172.26.10.17]
skipping: [172.26.10.18]

TASK [andrewrothstein.openjdk : resolve platform specific vars] ********************************************************************************
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12. Deprecation warnings can be disabled 
by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12. Deprecation warnings can be disabled 
by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12. Deprecation warnings can be disabled 
by setting deprecation_warnings=False in ansible.cfg.

TASK [andrewrothstein.openjdk : mkdir openjdks install dir] ************************************************************************************
changed: [172.26.10.17]
changed: [172.26.10.18]
changed: [172.26.10.16]

TASK [andrewrothstein.openjdk : check for openjdk installation] ********************************************************************************
ok: [172.26.10.17]
ok: [172.26.10.16]
ok: [172.26.10.18]

TASK [andrewrothstein.openjdk : download archive] **********************************************************************************************
changed: [172.26.10.17]
changed: [172.26.10.18]
changed: [172.26.10.16]

TASK [andrewrothstein.openjdk : unarchive] *****************************************************************************************************
changed: [172.26.10.17]
changed: [172.26.10.18]
changed: [172.26.10.16]

TASK [andrewrothstein.openjdk : delete archive] ************************************************************************************************
changed: [172.26.10.17]
changed: [172.26.10.16]
changed: [172.26.10.18]

TASK [andrewrothstein.openjdk : link...] *******************************************************************************************************
changed: [172.26.10.16]
changed: [172.26.10.17]
changed: [172.26.10.18]

TASK [andrewrothstein.openjdk : add to default path and ease systemd integration...] ***********************************************************
changed: [172.26.10.17] => (item={u'd': u'/etc/profile.d', u'f': u'openjdk.sh'})
changed: [172.26.10.18] => (item={u'd': u'/etc/profile.d', u'f': u'openjdk.sh'})
changed: [172.26.10.16] => (item={u'd': u'/etc/profile.d', u'f': u'openjdk.sh'})
changed: [172.26.10.17] => (item={u'd': u'/usr/local/openjdk/jdk-12.0.1+12-jre', u'f': u'openjdk.env'})
changed: [172.26.10.18] => (item={u'd': u'/usr/local/openjdk/jdk-12.0.1+12-jre', u'f': u'openjdk.env'})
changed: [172.26.10.16] => (item={u'd': u'/usr/local/openjdk/jdk-12.0.1+12-jre', u'f': u'openjdk.env'})

TASK [andrewrothstein.zookeeper : check for install...] ****************************************************************************************
ok: [172.26.10.16]
ok: [172.26.10.17]
ok: [172.26.10.18]

TASK [andrewrothstein.zookeeper : download zookeeper...] ***************************************************************************************
changed: [172.26.10.18]
changed: [172.26.10.17]
changed: [172.26.10.16]

TASK [andrewrothstein.zookeeper : unarchive zookeeper...] **************************************************************************************
changed: [172.26.10.17]
changed: [172.26.10.18]
changed: [172.26.10.16]

TASK [andrewrothstein.zookeeper : link zookeeper...] *******************************************************************************************
changed: [172.26.10.17]
changed: [172.26.10.16]
changed: [172.26.10.18]

TASK [andrewrothstein.zookeeper : cleanup...] **************************************************************************************************
changed: [172.26.10.17]
changed: [172.26.10.16]
changed: [172.26.10.18]

TASK [andrewrothstein.zookeeper : add to path...] **********************************************************************************************
changed: [172.26.10.17] => (item={u'm': u'0644', u'd': u'/etc/profile.d', u'f': u'zookeeper.sh'})
changed: [172.26.10.16] => (item={u'm': u'0644', u'd': u'/etc/profile.d', u'f': u'zookeeper.sh'})
changed: [172.26.10.18] => (item={u'm': u'0644', u'd': u'/etc/profile.d', u'f': u'zookeeper.sh'})

TASK [andrewrothstein.zookeeper-cluster : ensure the data subdir exists] ***********************************************************************
changed: [172.26.10.17]
changed: [172.26.10.16]
changed: [172.26.10.18]

TASK [andrewrothstein.zookeeper-cluster : configure...] ****************************************************************************************
changed: [172.26.10.17] => (item={u'd': u'/usr/local/zookeeper/conf', u'f': u'zoo.cfg'})
changed: [172.26.10.16] => (item={u'd': u'/usr/local/zookeeper/conf', u'f': u'zoo.cfg'})
changed: [172.26.10.18] => (item={u'd': u'/usr/local/zookeeper/conf', u'f': u'zoo.cfg'})
changed: [172.26.10.17] => (item={u'd': u'/usr/local/zookeeper/conf', u'f': u'log4j.properties'})
changed: [172.26.10.18] => (item={u'd': u'/usr/local/zookeeper/conf', u'f': u'log4j.properties'})
changed: [172.26.10.16] => (item={u'd': u'/usr/local/zookeeper/conf', u'f': u'log4j.properties'})
changed: [172.26.10.17] => (item={u'd': u'/usr/local/zookeeper/data', u'f': u'myid'})
changed: [172.26.10.18] => (item={u'd': u'/usr/local/zookeeper/data', u'f': u'myid'})
changed: [172.26.10.16] => (item={u'd': u'/usr/local/zookeeper/data', u'f': u'myid'})

TASK [andrewrothstein.zookeeper-cluster : configurating init system] ***************************************************************************
included: /home/centos/.ansible/roles/andrewrothstein.zookeeper-cluster/tasks/systemd.yml for 172.26.10.16, 172.26.10.17, 172.26.10.18

TASK [andrewrothstein.zookeeper-cluster : install systemd unit] ********************************************************************************
changed: [172.26.10.17] => (item={u'd': u'/etc/systemd/system', u'f': u'zookeeper.service'})
changed: [172.26.10.16] => (item={u'd': u'/etc/systemd/system', u'f': u'zookeeper.service'})
changed: [172.26.10.18] => (item={u'd': u'/etc/systemd/system', u'f': u'zookeeper.service'})

TASK [andrewrothstein.zookeeper-cluster : systemctl daemon-reload] *****************************************************************************
ok: [172.26.10.17]
ok: [172.26.10.16]
ok: [172.26.10.18]

TASK [andrewrothstein.zookeeper-cluster : launch zookeeper...] *********************************************************************************
changed: [172.26.10.17]
changed: [172.26.10.18]
changed: [172.26.10.16]

PLAY RECAP *************************************************************************************************************************************
172.26.10.16               : ok=21   changed=16   unreachable=0    failed=0    skipped=3    rescued=0    ignored=0   
172.26.10.17               : ok=21   changed=16   unreachable=0    failed=0    skipped=3    rescued=0    ignored=0   
172.26.10.18               : ok=21   changed=16   unreachable=0    failed=0    skipped=3    rescued=0    ignored=0  ```
patsevanton commented 4 years ago

May be use openjdk from system repo?

patsevanton commented 4 years ago

If use:

- name: Install ZooKeeper cluster
  hosts: zookeeper
  roles:
    - role: andrewrothstein.zookeeper
    - role: andrewrothstein.zookeeper-cluster

Error:

Apr 19 05:50:19 zookeper-0 systemd: Stopped Apache Zookeeper.
Apr 19 05:50:19 zookeper-0 systemd: Started Apache Zookeeper.
Apr 19 05:50:19 zookeper-0 zkServer.sh: Error: JAVA_HOME is not set and java could not be found in PATH.
Apr 19 05:50:19 zookeper-0 systemd: zookeeper.service: main process exited, code=exited, status=1/FAILURE
ngilmitdinov commented 4 years ago

Hello!

I use fix from this issue: https://github.com/andrewrothstein/ansible-zookeeper-cluster/issues/2

You can change EnvironmentFile in templates/zookeeper.service.j2

EnvironmentFile=-/usr/local/openjdk/jdk-13.0.2+8-jre/openjdk.env