Learn about Centmin Mod LEMP Stack today
Register Now

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

    888
    230
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +376
    Local Time:
    11:53 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,533
    231
    63
    May 31, 2014
    Ratings:
    +394
    Local Time:
    12:53 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 Active Member

    888
    230
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +376
    Local Time:
    11:53 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

    29,041
    6,590
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,785
    Local Time:
    7:53 PM
    Nginx 1.13.x
    MariaDB 5.5
    done :)
     
    • Creative Creative x 1
  5. elargento

    elargento Member

    284
    16
    18
    Jan 4, 2016
    Ratings:
    +37
    Local Time:
    6:53 AM
    10
    Would be better to yum remove and install again to avoid upgrade issues
     
  6. deltahf

    deltahf Active Member

    203
    99
    28
    Jun 8, 2014
    Ratings:
    +149
    Local Time:
    5:53 AM
    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

    29,041
    6,590
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,785
    Local Time:
    7:53 PM
    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,830
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    5:53 PM
    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

    888
    230
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +376
    Local Time:
    11:53 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,830
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    5:53 PM
    1.11
    10.2
  11. RoldanLT

    RoldanLT Well-Known Member

    3,830
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    5:53 PM
    1.11
    10.2
  12. Xon

    Xon Active Member

    125
    56
    28
    Nov 16, 2015
    Ratings:
    +162
    Local Time:
    5:53 PM
    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,830
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    5:53 PM
    1.11
    10.2
    Haha too bad :D.
    I think this will work fine for several months or year on the default location: