Get the most out of your Centmin Mod LEMP stack
Become a Member

Xenforo How To Install Elasticsearch 5.x for Xenforo

Discussion in 'Centmin Mod User Tutorials & Guides' started by Sunka, Nov 7, 2016.

  1. Sunka

    Sunka Well-Known Member

    1,044
    286
    83
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +464
    Local Time:
    6:02 PM
    Nginx 1.15.0
    MariaDB 10.2.15
    This is tutorial for installing (not upgrading) elasticsearch 5 on centos.
    If I am missing something, please post here.
    Without help from @eva2000 and @Xon this tutorial could not be alive.

    I tried to upgrade first from 2.4 version, but ended up with strange errors, so I delete (yum remove elasticsearch) and install fresh new one.
    Because of something, if you remove old one and than install new one elasticsearch, change cluster name to new one, do not use old one (you have to change it also in ACP)

    Code:
    rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
    
    Code:
    nano /etc/yum.repos.d/elasticsearch.repo
    
    insert this:
    Code:
    [elasticsearch-5.x]
    name=Elasticsearch repository for 5.x packages
    baseurl=https://artifacts.elastic.co/packages/5.x/yum
    gpgcheck=1
    gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
    enabled=1
    autorefresh=1
    type=rpm-md
    
    Code:
    yum -y install java-1.8.0-openjdk
    
    Code:
    yum -y install elasticsearch
    
    Code:
    curl -XPUT 'http://127.0.0.1:9200/_template/default' -d'{
      "template": "*",
      "settings": {
        "number_of_shards": "1",
        "number_of_replicas": "0"
      }
    }'
    
    Code:
    nano /etc/elasticsearch/elasticsearch.yml
    
    at the end of file add this:
    Code:
    cluster.name: CUSTOM NAME OF YOUR CLUSTER (same name should be inserted into your XenForo field in Admin ontrol Panel)
    network.host: 127.0.0.1
    http.port: 9200
    
    set how much ram you will add for elasticsearch - 512 megabytes is set in example (botx Xms and Xmx must have same value)
    Code:
    nano /etc/elasticsearch/jvm.options
    
    Code:
    -Xms512m
    -Xmx512m
    
    Code:
    mkdir /etc/elasticsearch/scripts/
    
    Code:
    cp -a /path/to/xenforoinstall/library/XenES/_scripts/*.groovy /etc/elasticsearch/scripts/
    
    Code:
    service elasticsearch start
    
    Code:
    systemctl daemon-reload
    
    Code:
    systemctl enable elasticsearch.service
    
    Code:
    systemctl start elasticsearch.service
    
    test if everything OK (give 1-2 minute after restarting elasticsearch)
    Code:
    curl -XGET '127.0.0.1:9200'
    
     
    Last edited by a moderator: Mar 20, 2017
    • Like Like x 1
    • Winner Winner x 1
    • Informative Informative x 1
  2. pamamolf

    pamamolf Well-Known Member

    3,119
    295
    83
    May 31, 2014
    Ratings:
    +531
    Local Time:
    7:02 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Great thank you :)

    It will be good to post also the upgrade tutorial :)
     
  3. Sunka

    Sunka Well-Known Member

    1,044
    286
    83
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +464
    Local Time:
    6:02 PM
    Nginx 1.15.0
    MariaDB 10.2.15
    Just one notice.
    @eva2000 please edit first post

    Code:
    curl -XPUT 'http://localhost:9200/_template/default' -d'{
      "template": "*",
      "settings": {
        "number_of_shards": "1",
        "number_of_replicas": "0"
      }
    }'
    Should be

    Code:
    curl -XPUT 'http://127.0.0.1:9200/_template/default' -d'{
      "template": "*",
      "settings": {
        "number_of_shards": "1",
        "number_of_replicas": "0"
      }
    }'

    You can use localhost or 127.0.0.1 but whatever you choose, must be same on all places in installing
     
  4. eva2000

    eva2000 Administrator Staff Member

    37,212
    8,126
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,512
    Local Time:
    3:02 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    done :)
     
    • Creative Creative x 1
  5. elargento

    elargento Member

    334
    17
    18
    Jan 4, 2016
    Ratings:
    +42
    Local Time:
    2:02 PM
    10
    Would be better to yum remove and install again to avoid upgrade issues
     
  6. deltahf

    deltahf Premium Member Premium Member

    299
    134
    43
    Jun 8, 2014
    Ratings:
    +216
    Local Time:
    12:02 PM
    Thanks so much for this tutorial, @Sunka!

    I am updating from an ancient version of ElasticSearch (1.5.2... :censored:) that was installed from the old Axivo repo that used to be so popular. I started having some trouble with it and decided it was time to update.

    Anyway, I got it installed and ES is running 5.5.1 now but there's a small issue... I'm running CentOS 6.9 and I don't think I have systemctl!
    Code:
    $ systemctl daemon-reload
    bash: systemcetl: command not found
    
    What should I do instead? Is this tutorial for CentOS 7 only?
     
    • Like Like x 1
  7. eva2000

    eva2000 Administrator Staff Member

    37,212
    8,126
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,512
    Local Time:
    3:02 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    for centos 6 just
    Code (Text):
    service elasticsearch restart
    

    is enough to restart
     
    • Like Like x 1
    • Agree Agree x 1
  8. rdan

    rdan Premium Member Premium Member

    4,412
    1,058
    113
    May 25, 2014
    Ratings:
    +1,541
    Local Time:
    1:02 AM
    Mainline
    10.2
    Small correction, after:
    You should start it first or the next command will not work.
    Code:
    service elasticsearch start
     
    • Like Like x 2
  9. Sunka

    Sunka Well-Known Member

    1,044
    286
    83
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +464
    Local Time:
    6:02 PM
    Nginx 1.15.0
    MariaDB 10.2.15
    This one?
    Code:
    curl -XPUT 'http://127.0.0.1:9200/_template/default' -d'{
      "template": "*",
      "settings": {
        "number_of_shards": "1",
        "number_of_replicas": "0"
      }
    }'
     
    • Like Like x 1
  10. rdan

    rdan Premium Member Premium Member

    4,412
    1,058
    113
    May 25, 2014
    Ratings:
    +1,541
    Local Time:
    1:02 AM
    Mainline
    10.2
  11. rdan

    rdan Premium Member Premium Member

    4,412
    1,058
    113
    May 25, 2014
    Ratings:
    +1,541
    Local Time:
    1:02 AM
    Mainline
    10.2
  12. Xon

    Xon Active Member

    151
    60
    28
    Nov 16, 2015
    Ratings:
    +192
    Local Time:
    1:02 AM
    1.15.x
    MariaDB 10.3.x
    No idea. Elastic search introduces so many breaking changes so often I try to keep everything as stock as possible :p
     
    • Like Like x 1
  13. rdan

    rdan Premium Member Premium Member

    4,412
    1,058
    113
    May 25, 2014
    Ratings:
    +1,541
    Local Time:
    1:02 AM
    Mainline
    10.2
    Haha too bad :D.
    I think this will work fine for several months or year on the default location:

     
  14. deltahf

    deltahf Premium Member Premium Member

    299
    134
    43
    Jun 8, 2014
    Ratings:
    +216
    Local Time:
    12:02 PM
    Recently had to reboot my server, and when it came back online, ElasticSearch was not running and I had to start it manually.

    Is there something else I need to do for CentOS 6.9?
     
  15. rdan

    rdan Premium Member Premium Member

    4,412
    1,058
    113
    May 25, 2014
    Ratings:
    +1,541
    Local Time:
    1:02 AM
    Mainline
    10.2
    sudo chkconfig --add elasticsearch
     
    • Informative Informative x 1
  16. rdan

    rdan Premium Member Premium Member

    4,412
    1,058
    113
    May 25, 2014
    Ratings:
    +1,541
    Local Time:
    1:02 AM
    Mainline
    10.2
  17. negative

    negative Active Member

    260
    26
    28
    Apr 11, 2015
    Ratings:
    +59
    Local Time:
    7:02 PM
    1.9.10
    10.1.11
    @Sunka I'm using still version 2.0 and i want to upgrade it but What about to upgrade directly to version 6.0. I think it will be released soon. Latest elastic search add-on of xenforo supports the version 6.0

    Should i upgrade to beta now or just wait to final version of the 6.0 ? Thanks
     
  18. Sunka

    Sunka Well-Known Member

    1,044
    286
    83
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +464
    Local Time:
    6:02 PM
    Nginx 1.15.0
    MariaDB 10.2.15
    My advice is to uninstall 2.x version and install newest one (5.6.1 or 5.6.2).
    From that version you will be able to do rolling upgrade to 6.0 version when it will be stable
     
    • Like Like x 1
  19. negative

    negative Active Member

    260
    26
    28
    Apr 11, 2015
    Ratings:
    +59
    Local Time:
    7:02 PM
    1.9.10
    10.1.11
    I've installed the elasticsearch version 6-RC1 and reindex everything on my forum with 6.0 repo

    Code:
    [elasticsearch-6.x]
    name=Elasticsearch repository for 6.x packages
    baseurl=https://artifacts.elastic.co/packages/6.x-prerelease/yum
    gpgcheck=1
    gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
    enabled=1
    autorefresh=1
    type=rpm-md
    So, when full version come for 6.0, it will be easy to upgrade to final version without any data upgrade or clone.
     
    • Like Like x 1
  20. Andy

    Andy Premium Member Premium Member

    426
    61
    28
    Aug 6, 2014
    Ratings:
    +85
    Local Time:
    12:02 PM
    I did the same thing and got error on Xenforo that ES is not running. I have tried to restart it without success.
    Then uninstall elasticsearch and then reinstall ES 5 and it works again.
     
    Last edited: Oct 2, 2017
..