Welcome to Centmin Mod Community
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 Active Member

    917
    240
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +388
    Local Time:
    1:24 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    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

    2,723
    242
    63
    May 31, 2014
    Ratings:
    +433
    Local Time:
    2:24 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Great thank you :)

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

    Sunka Active Member

    917
    240
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +388
    Local Time:
    1:24 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    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

    30,166
    6,784
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    9:24 AM
    Nginx 1.13.x
    MariaDB 5.5
    done :)
     
    • Creative Creative x 1
  5. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    8:24 PM
    10
    Would be better to yum remove and install again to avoid upgrade issues
     
  6. deltahf

    deltahf Active Member

    207
    101
    43
    Jun 8, 2014
    Ratings:
    +154
    Local Time:
    7:24 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

    30,166
    6,784
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    9:24 AM
    Nginx 1.13.x
    MariaDB 5.5
    for centos 6 just
    Code (Text):
    service elasticsearch restart
    

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

    RoldanLT Well-Known Member

    3,901
    949
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,298
    Local Time:
    7:24 AM
    1.11
    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 Active Member

    917
    240
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +388
    Local Time:
    1:24 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    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. RoldanLT

    RoldanLT Well-Known Member

    3,901
    949
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,298
    Local Time:
    7:24 AM
    1.11
    10.2
  11. RoldanLT

    RoldanLT Well-Known Member

    3,901
    949
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,298
    Local Time:
    7:24 AM
    1.11
    10.2
  12. Xon

    Xon Active Member

    130
    57
    28
    Nov 16, 2015
    Ratings:
    +171
    Local Time:
    7:24 AM
    1.11.x
    MariaDB 10.1.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. RoldanLT

    RoldanLT Well-Known Member

    3,901
    949
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,298
    Local Time:
    7:24 AM
    1.11
    10.2
    Haha too bad :D.
    I think this will work fine for several months or year on the default location:

     
  14. deltahf

    deltahf Active Member

    207
    101
    43
    Jun 8, 2014
    Ratings:
    +154
    Local Time:
    7:24 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. RoldanLT

    RoldanLT Well-Known Member

    3,901
    949
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,298
    Local Time:
    7:24 AM
    1.11
    10.2
    sudo chkconfig --add elasticsearch
     
    • Informative Informative x 1
  16. RoldanLT

    RoldanLT Well-Known Member

    3,901
    949
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,298
    Local Time:
    7:24 AM
    1.11
    10.2
  17. negative

    negative Member

    216
    21
    18
    Apr 11, 2015
    Ratings:
    +49
    Local Time:
    2:24 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 Active Member

    917
    240
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +388
    Local Time:
    1:24 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    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 Member

    216
    21
    18
    Apr 11, 2015
    Ratings:
    +49
    Local Time:
    2:24 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.
     
    • Like Like x 1
  20. Andy

    Andy Active Member

    315
    45
    28
    Aug 6, 2014
    Ratings:
    +54
    Local Time:
    7:24 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