Code Monkey home page Code Monkey logo

Comments (2)

tychay avatar tychay commented on May 30, 2024

Okay tested. I needed a single task after the java role and before the elasticsearch role.

---
# This avoids the java10 error: 'Unrecognized VM option 'UseParNewGC'
# for elasticsearch
# c.f. https://stackoverflow.com/questions/49623648/logstash-with-java10-get-error-unrecognized-vm-option-useparnewgc
# in a manner similar to the way elastic.elasticsearch handles it
# c.f. https://github.com/elastic/ansible-elasticsearch/blob/master/tasks/java.yml for redhat
- name: downgrade to 1.8 if available (Debian)
  block: 
  - name: Get the installed java path (for Debian)
    shell: "update-alternatives --display java | grep '^/' | awk '{print $1}' | grep java-8 | head -1"
    become: yes
    register: java_full_path
    failed_when: false
    changed_when: false
  - name: set java alternatives to 1.8
    alternatives:
      name: java
      path: "{{ java_full_path.stdout }}"
      link: /usr/bin/java
    when: java_full_path is defined
  when: ansible_os_family == 'Debian'
- name: downgrade to 1.8 if available (RedHat)
  block: 
  - name: Get the installed java path (for RedHat)
    shell: "update-alternatives --display java | grep '^/' | awk '{print $1}' | grep 1.8.0 | head -1"
    become: yes
    register: java_full_path
    failed_when: false
    changed_when: false
  - name: set java alternatives to 1.8
    alternatives:
      name: java
      path: "{{ java_full_path.stdout }}"
      link: /usr/bin/java
    when: java_full_path is defined
  when: ansible_os_family == 'RedHat'

This downgrades java before starting the elasticsearch server. (Theoretically, it could go anywhere but if put before the roles, java might not be installed, and if put after then the script will fail/hang waiting for the server to start.

I only tested this for Ubuntu 18.04 LTS

from ansible-role-elasticsearch.

geerlingguy avatar geerlingguy commented on May 30, 2024

Yeah: https://travis-ci.org/geerlingguy/ansible-role-elasticsearch/jobs/445212649

The actual failure (if you go in and monitor syslog when it tries starting the service) is:

Oct 23 20:31:51 instance systemd[1]: Started Elasticsearch.
Oct 23 20:31:51 instance elasticsearch[5805]: Unrecognized VM option 'UseParNewGC'
Oct 23 20:31:51 instance elasticsearch[5805]: Error: Could not create the Java Virtual Machine.
Oct 23 20:31:51 instance elasticsearch[5805]: Error: A fatal exception has occurred. Program will exit.

It looks like this role is still on ES 2.x (yikes!). Upgrading to the latest version of Elasticsearch should make it compatible with Java 10...

from ansible-role-elasticsearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.