Want more timely Centmin Mod News Updates?
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

    851
    210
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +340
    Local Time:
    9:18 PM
    Nginx 1.11.13
    MariaDB 10.1.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
    • Winner Winner x 1
    • Informative Informative x 1
  2. pamamolf

    pamamolf Well-Known Member

    2,426
    217
    63
    May 31, 2014
    Ratings:
    +370
    Local Time:
    10:18 PM
    Nginx-1.11.x
    MariaDB 10
    Great thank you :)

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

    Sunka Active Member

    851
    210
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +340
    Local Time:
    9:18 PM
    Nginx 1.11.13
    MariaDB 10.1.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

    27,179
    6,224
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,154
    Local Time:
    5:18 AM
    Nginx 1.13.x
    MariaDB 5.5
    done :)
     
    • Creative Creative x 1
  5. elargento

    elargento Premium Member Premium Member

    206
    15
    18
    Jan 4, 2016
    Ratings:
    +27
    Local Time:
    4:18 PM
    10
    Would be better to yum remove and install again to avoid upgrade issues