Want to subscribe to topics you're interested in?
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,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    5:04 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    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
  2. pamamolf

    pamamolf Premium Member Premium Member

    4,101
    428
    83
    May 31, 2014
    Ratings:
    +837
    Local Time:
    6:04 AM
    Nginx-1.26.x
    MariaDB 10.6.x
    Great thank you :)

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

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    5:04 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    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

    55,223
    12,253
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,831
    Local Time:
    1:04 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    done :)
     
  5. elargento

    elargento Member

    352
    17
    18
    Jan 4, 2016
    Ratings:
    +44
    Local Time:
    12:04 AM
    10
    Would be better to yum remove and install again to avoid upgrade issues
     
  6. deltahf

    deltahf Premium Member Premium Member

    587
    265
    63
    Jun 8, 2014
    Ratings:
    +489
    Local Time:
    11:04 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?
     
  7. eva2000

    eva2000 Administrator Staff Member

    55,223
    12,253
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,831
    Local Time:
    1:04 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    for centos 6 just
    Code (Text):
    service elasticsearch restart
    

    is enough to restart
     
  8. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    11:04 AM
    Mainline
    10.2
    Small correction, after:
    You should start it first or the next command will not work.
    Code:
    service elasticsearch start
     
  9. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    5:04 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    This one?
    Code:
    curl -XPUT 'http://127.0.0.1:9200/_template/default' -d'{
      "template": "*",
      "settings": {
        "number_of_shards": "1",
        "number_of_replicas": "0"
      }
    }'
     
  10. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    11:04 AM
    Mainline
    10.2
  11. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    11:04 AM
    Mainline
    10.2
  12. Xon

    Xon Active Member

    173
    61
    28
    Nov 16, 2015
    Ratings:
    +229
    Local Time:
    11:04 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
     
  13. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    11:04 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

    587
    265
    63
    Jun 8, 2014
    Ratings:
    +489
    Local Time:
    11:04 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 Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    11:04 AM
    Mainline
    10.2
    sudo chkconfig --add elasticsearch
     
  16. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    11:04 AM
    Mainline
    10.2
  17. negative

    negative Active Member

    415
    50
    28
    Apr 11, 2015
    Ratings:
    +98
    Local Time:
    6:04 AM
    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,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    5:04 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    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
     
  19. negative

    negative Active Member

    415
    50
    28
    Apr 11, 2015
    Ratings:
    +98
    Local Time:
    6:04 AM
    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.
     
  20. Andy

    Andy Active Member

    544
    89
    28
    Aug 6, 2014
    Ratings:
    +133
    Local Time:
    10:04 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