首页 > 系统相关 >Install Elasticsearch 2.x on CentOS 6 by rpm

Install Elasticsearch 2.x on CentOS 6 by rpm

时间:2023-06-04 18:34:49浏览次数:62  
标签:node name CentOS cluster Elasticsearch elasticsearch nodes rpm


 http://techieroop.com/install-elasticsearch-2-x-on-centos-6/

 

This article will cover install Elasticsearch 2.x version on CentOS 6. Also guideline to change to Default Cluster and Index settings in Elasticsearch 2.x. So Let’s start with prerequisites

Prerequisites:

Elasticsearch needed at least Java 7.

Install Elasticsearch 2.x On CentOS 6 using Elasticsearch Repository

Install Public Signing Key:



rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch



Create new repo in your /etc/yum.repos.d/ directory. For example I have created elasticsearch.repo here.

/etc/yum.repos.d/elasticsearch.repo


[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1

Now Elasticsearch 2.x will avilable for installation using yum



yum install elasticsearch



Note: The repositories do not work with older rpm based distributions that still use RPM v3, like CentOS5.



chkconfig --add elasticsearch



Otherwise if your distribution is using systemd:



sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable elasticsearch.service



Now we have done with Elasticsearch installation. You can check your default Elasticsearch configuration in/etc/elasticsearch/elasticsearch.yml

By default its cluster name will be elasticsearch.

Now we will change Cluster, Index and Host info in elasticsearch.yml

To illustrate here I am naming my Elasticsearch cluster name “Techieroop” and node name “techieroop-es-node“. Add your host into “discovery.zen.ping.unicast.hosts“.

Summary of important Elasticsearch Configuration:



cluster.name: TechieRoop node.name: techieroop-es-node discovery.zen.ping.unicast.hosts: ["127.0.0.1"]



Your elasticsearch.yml will be look like this



# =========== Elasticsearch Configuration ==============
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ----------------- Cluster ---------------
#
# Use a descriptive name for your cluster:
#
 cluster.name: TechieRoop
#
#------------------- Node ----------------
#
# Use a descriptive name for the node:
#
 node.name: techieroop-es-node
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------- Paths ----------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# path.logs: /path/to/logs
#
# ------------------ Memory -----------------
#
# Lock the memory on startup:
#
# bootstrap.mlockall: true
#
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ----------------- Network ----------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
# network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# ---------------- Gateway -------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# --------------- Discovery -----------------
#
# Elasticsearch nodes will find each other via unicast, by default.
#
# Pass an initial list of hosts to perform discovery when new node is started:
#  The default list of hosts is ["127.0.0.1", "[::1]"]
#
 discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
# discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# --------------- Various -----------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true



Start the Elasticsearch:



sudo service elasticsearch start



Verify you installation :



curl -XGET 'localhost:9200'



Output:



{
      "name" : "techieroop-es-node",
      "cluster_name" : "Techieroop",
      "version" : {
        "number" : "2.1.1",
        "build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
        "build_timestamp" : "2015-12-15T13:05:55Z",
        "build_snapshot" : false,
        "lucene_version" : "5.3.1"
      },
      "tagline" : "You Know, for Search"
    }


Default Path

Type

Location

Description

home

/usr/share/elasticsearch

Home of elasticsearch installation

bin

/usr/share/elasticsearch/bin

Binary scripts including elasticsearch to start a node.

conf

/etc/elasticsearch

Configuration files elasticsearch.yml and logging.yml.

conf

/etc/sysconfig/elasticsearch

Environment variables including heap size, file descriptors.

data

/var/lib/elasticsearch

Default path to store elasticsearch data .

logs

/var/log/elasticsearch

Default log location.

plugins

/usr/share/elasticsearch/plugins

Plugin directory, all plugin installed in separate directory here.

script

/etc/elasticsearch/scripts

Default script files location.



Install Elasticsearch 2.x on CentOS 6http://techieroop.com/install-elasticsearch-2-x-on-centos-6/http://techieroop.com/wp-content/uploads/2016/01/install-elasticsearch-2-on-centos6.pnghttp://techieroop.com/wp-content/uploads/2016/01/install-elasticsearch-2-on-centos6-150x150.png17 January 2016RoopendraElasticsearchElastic,Elasticsearch



Install Elasticsearch 2.1 on CentOS 6 This article will cover install Elasticsearch 2.x version on CentOS 6. Also guideline to change to Default Cluster and Index settings in Elasticsearch 2.x. So Let's start with prerequisitesPrerequisites:Elasticsearch needed at least Java 7. Install Elasticsearch 2.x On CentOS 6 using Elasticsearch Repository Install Public Signing...



<h3>Install Elasticsearch 2.1 on CentOS 6</h3> This article will cover install Elasticsearch 2.x version on CentOS 6. Also guideline to change to Default Cluster and Index settings in Elasticsearch 2.x. So Let's start with prerequisites<strong>Prerequisites:</strong>Elasticsearch needed at least Java 7. <h3>Install Elasticsearch 2.x On CentOS 6 using Elasticsearch Repository</h3> <strong>Install Public Signing Key:</strong> <pre>rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch</pre> Create new repo in your <strong>/etc/yum.repos.d/</strong> directory. For example I have created elasticsearch.repo here./etc/yum.repos.d/elasticsearch.repo <pre>[elasticsearch-2.x] name=Elasticsearch repository for 2.x packages baseurl=http://packages.elastic.co/elasticsearch/2.x/centos gpgcheck=1 gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch enabled=1</pre> Now Elasticsearch 2.x will avilable for installation using yum <pre>yum install elasticsearch</pre> Note: The repositories do not work with older rpm based distributions that still use RPM v3, like CentOS5. <pre>chkconfig --add elasticsearch</pre> Otherwise if your distribution is using systemd: <pre>sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable elasticsearch.service</pre> Now we have done with Elasticsearch installation. You can check your default Elasticsearch configuration in <strong>/etc/elasticsearch/elasticsearch.yml</strong>By default its cluster name will be elasticsearch.Now we will change Cluster, Index and Host info in elasticsearch.ymlTo illustrate here I am naming my Elasticsearch cluster name "<em><strong>Techieroop</strong></em>" and node name "<em><strong>techieroop-es-node</strong></em>". Add your host into "<strong><em>discovery.zen.ping.unicast.hosts</em></strong>".Summary of important Elasticsearch Configuration: <pre>cluster.name: TechieRoop node.name: techieroop-es-node discovery.zen.ping.unicast.hosts: ["127.0.0.1"]</pre> Your <strong>elasticsearch.yml</strong> will be look like this <pre># =========== Elasticsearch Configuration ============== # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please see the documentation for further information on configuration options: # <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html> # # ----------------- Cluster --------------- # # Use a descriptive name for your cluster: # cluster.name: TechieRoop # #------------------- Node ---------------- # # Use a descriptive name for the node: # node.name: techieroop-es-node # # Add custom attributes to the node: # # node.rack: r1 # # ----------------- Paths ---------------- # # Path to directory where to store the data (separate multiple locations by comma): # # path.data: /path/to/data # # Path to log files: # # path.logs: /path/to/logs # # ------------------ Memory ----------------- # # Lock the memory on startup: # # bootstrap.mlockall: true # # Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory # available on the system and that the owner of the process is allowed to use this limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ----------------- Network ---------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # # network.host: 192.168.0.1 # # Set a custom port for HTTP: # # http.port: 9200 # # For more information, see the documentation at: # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html> # # ---------------- Gateway ------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # # gateway.recover_after_nodes: 3 # # For more information, see the documentation at: # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html> # # --------------- Discovery ----------------- # # Elasticsearch nodes will find each other via unicast, by default. # # Pass an initial list of hosts to perform discovery when new node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # discovery.zen.ping.unicast.hosts: ["127.0.0.1"] # # Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1): # # discovery.zen.minimum_master_nodes: 3 # # For more information, see the documentation at: # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html> # # --------------- Various ----------------- # # Disable starting multiple nodes on a single system: # # node.max_local_storage_nodes: 1 # # Require explicit names when deleting indices: # # action.destructive_requires_name: true </pre> <strong>Start the Elasticsearch:</strong> <pre>sudo service elasticsearch start</pre> <strong>Verify you installation :</strong> <pre>curl -XGET 'localhost:9200'</pre> <strong>Output:</strong> <pre>{ "name" : "techieroop-es-node", "cluster_name" : "Techieroop", "version" : { "number" : "2.1.1", "build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71", "build_timestamp" : "2015-12-15T13:05:55Z", "build_snapshot" : false, "lucene_version" : "5.3.1" }, "tagline" : "You Know, for Search" }</pre>Roopendrahttps://plus.google.com/+Techieroopendra[email protected]'m Roopendra Vishwakarma, a Programmer and Blogger from India. I have experience in Web Development and Open Source Technology. I mostly write about latest technology, getting started tutorial and tricks and tips.TechieRoop



(Visited 566 times, 100 visits today)



 

 

标签:node,name,CentOS,cluster,Elasticsearch,elasticsearch,nodes,rpm
From: https://blog.51cto.com/u_2700990/6411604

相关文章

  • CentOS 7安装配置Samba
    [color=darkblue]surootyum-yinstallsambasamba-clientsamba-commongroupaddwwwuseradd-gwwwwwwpasswdwww->输入这个用户密码mkdir-p/home/www/datachown-Rwww:www/home/www/datachmod-R777/home/www/datacd/etc/sambacp/etc/samba/smb.conf/etc/s......
  • Centos设置Tomcat开机启动
    [size=x-large][color=red]Centos7开机启动[/color][/size]方式1:CentOS7.x设置自定义开机启动,添加自定义系统服务[url]http://www.centoscn.com/CentOS/config/2015/0507/5374.html[/url]方式2:centos下实现程序开机自启动(tomcat为例CentOS7开机......
  • 《CentOS 7.5系统管理与运维实战》pdf电子书免费下载
    本书从实际应用出发,以CentOS 7.5作为操作系统基础,介绍目前企业中常用的软件平台架设和管理方法,通过运维的视角来介绍运维的基础知识和软件平台的常见搭建思路。本书共14章,分为3个知识区块。涵盖的主要内容有:以CentOS7.5特性和安装、运维基础、网络配置与结构为第1个知识区块的......
  • 通过DSL实现Elasticsearch数据高亮处理
    高亮显示的实现分为两步:1)给文档中的所有关键字都添加一个标签,例如标签2)页面给标签编写CSS样式语法:点击查看代码GET /hotel/_search{  "query": {    "match": {      "FIELD": "TEXT"//查询条件,高亮一定要使用全文检索查询    }  },  "h......
  • 通过DSL实现Elasticsearch数据排序功能
    普通字段排序语法:点击查看代码GET /indexName/_search{  "query": {    "match_all": {}  },  "sort": [    {      "FIELD": "desc"  // 排序字段、排序方式ASC、DESC    }  ]}示例:点击查看代码GET/hotel/_search{"q......
  • 通过DSL实现Elasticsearch数据搜索功能
    DSL查询分类查询所有:查询出所有数据,一般测试用。例如:match_all全文检索(fulltext)查询:利用分词器对用户输入内容分词,然后去倒排索引库中匹配。例如:match_querymulti_match_query精确查询:根据精确词条值查找数据,一般是查找keyword、数值、日期、boolean等类型字段。例如:i......
  • centos的时间不准确的修复
    #################             ......
  • 4种数据同步到Elasticsearch方案
    上周听到公司同事分享MySQL同步数据到ES的方案,发现很有意思,感觉有必要将这块知识点再总结提炼一下,就有了这篇文章。本文会先讲述数据同步的4种方案,并给出常用数据迁移工具,干货满满!不BB,上文章目录:1.前言在实际项目开发中,我们经常将MySQL作为业务数据库,ES作为查询......
  • 《Linux基础与服务管理(基于CentOS 7.6)》pdf电子书免费下载
    本书以目前广泛使用的CentOS 7.6平台为例,由浅入深、系统地介绍了Linux基础及对Linux各种服务的管理。*书共11章,主要内容*括Linux简介、基础*作命令、账户与权限管理、文件系统与磁盘管理、网络管理与系统监控、软件*管理、进程与基础服务、常用服务器配置、常用集群配置、常用系......
  • CentOS安装jdk的三种方法
    方法一:手动解压JDK的压缩包,然后设置环境变量 1.在/usr/目录下创建java目录 [root@localhost~]#mkdir/usr/java[root@localhost~]#cd/usr/java2.下载,然后解压[root@localhostjava]#curl-Ohttp://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x6......