首页 > 系统相关 >Elasticsearch 入门:CentOS 5.6 安装 Elasticsearch 5.0

Elasticsearch 入门:CentOS 5.6 安装 Elasticsearch 5.0

时间:2023-01-14 21:36:12浏览次数:65  
标签:5.0 node 01 CentOS 07T12 INFO Elasticsearch elasticsearch 2017


0. 操作系统:CentOS release 5.6 i686 athlon i386 GNU/Linux

1. 安装 java jdk1.8 (参考:​​Centos 6.5 安装java及设置默认jdk版本​​)
2. 下载安装包:​​​elasticsearch-5.0.0.tar.zip​


注:此为虚拟机测试,以下系统资源配置会较低。


解压文件

# tar zxvf elasticsearch-5.0.0.tar.gz
# mv elasticsearch-5.0.0 /usr/local/elasticsearch
# mkdir -p /usr/local/elasticsearch/{data,logs}


配置 es 参数文件 (Important Elasticsearch configuration

# vi /usr/local/elasticsearch/config/elasticsearch.yml
# 注意冒号后有空格
http.port: 9200
node.name: node-1
cluster.name: es_cluster
network.host: 192.168.1.222
bootstrap.memory_lock: false
path.data: /usr/local/elasticsearch/data
path.logs: /usr/local/elasticsearch/logs


配置足够内存 (Set JVM heap size via jvm.options

# vi /usr/local/elasticsearch/config/jvm.options
-Xms512M
-Xmx512M


配置环境变量

# vi /etc/profile  
export ES_HOME=/usr/local/elasticsearch

# source /etc/profile


添加独立用户,并启动服务

# groupadd elsearch
# useradd elsearch -g elsearch
# chown -R elsearch:elsearch /usr/local/elasticsearch
# su elsearch
# cd /usr/local/elasticsearch/bin
# ./elasticsearch


可能错误(一)

ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [elsearch] likely too low, increase to at least [2048]
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]


解决:修改配置
# https://www.elastic.co/guide/en/elasticsearch/reference/master/setting-system-settings.html

# vi /etc/security/limits.conf #永久设置
elsearch soft nofile 65536
elsearch hard nofile 65536
elsearch soft nproc 2048
elsearch hard nproc 2048

# ulimit -n 65536 #临时设置,重启无效
# ulimit -u 2048
# ulimit -a

# vi /etc/sysctl.conf #永久设置
vm.max_map_count=262144

# sysctl -w vm.max_map_count=262144 #临时设置,重启无效
# sysctl -a | grep "vm.max_map_count"


可能错误(二)

Java HotSpot(TM) Server VM warning: INFO: os::commit_memory(0xcc000000, 469762048, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 469762048 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /usr/local/elasticsearch/bin/hs_err_pid7598.log


解决:修改足够的内存

# vi /usr/local/elasticsearch/config/jvm.options
-Xms512M
-Xmx512M

# vi /usr/local/elasticsearch/bin/elasticsearch
# ES_JAVA_OPTS="-Xms512m -Xmx512m" $ES_HOME/bin/elasticsearch


正常启动服务状态

[2017-01-07T12:18:21,508][INFO ][o.e.n.Node               ] [node-1] initializing ...
[2017-01-07T12:18:21,814][INFO ][o.e.e.NodeEnvironment ] [node-1] using [1] data paths, mounts [[/ (/dev/sda2)]], net usable_space [11gb], net total_space [17.7gb], spins? [possibly], types [ext3]
[2017-01-07T12:18:21,816][INFO ][o.e.e.NodeEnvironment ] [node-1] heap size [505.6mb], compressed ordinary object pointers [unknown]
[2017-01-07T12:18:21,849][INFO ][o.e.n.Node ] [node-1] version[5.0.0], pid[16529], build[253032b/2016-10-26T04:37:51.531Z], OS[Linux/2.6.18-238.el5/i386], JVM[Oracle Corporation/Java HotSpot(TM) Server VM/1.8.0_111/25.111-b14]
[2017-01-07T12:18:30,971][INFO ][o.e.p.PluginsService ] [node-1] loaded module [aggs-matrix-stats]
[2017-01-07T12:18:30,972][INFO ][o.e.p.PluginsService ] [node-1] loaded module [ingest-common]
[2017-01-07T12:18:30,972][INFO ][o.e.p.PluginsService ] [node-1] loaded module [lang-expression]
[2017-01-07T12:18:30,972][INFO ][o.e.p.PluginsService ] [node-1] loaded module [lang-groovy]
[2017-01-07T12:18:30,972][INFO ][o.e.p.PluginsService ] [node-1] loaded module [lang-mustache]
[2017-01-07T12:18:30,972][INFO ][o.e.p.PluginsService ] [node-1] loaded module [lang-painless]
[2017-01-07T12:18:30,972][INFO ][o.e.p.PluginsService ] [node-1] loaded module [percolator]
[2017-01-07T12:18:30,974][INFO ][o.e.p.PluginsService ] [node-1] loaded module [reindex]
[2017-01-07T12:18:30,974][INFO ][o.e.p.PluginsService ] [node-1] loaded module [transport-netty3]
[2017-01-07T12:18:30,975][INFO ][o.e.p.PluginsService ] [node-1] loaded module [transport-netty4]
[2017-01-07T12:18:30,976][INFO ][o.e.p.PluginsService ] [node-1] no plugins loaded
[2017-01-07T12:18:55,728][INFO ][o.e.n.Node ] [node-1] initialized
[2017-01-07T12:18:55,728][INFO ][o.e.n.Node ] [node-1] starting ...
[2017-01-07T12:18:59,185][INFO ][o.e.t.TransportService ] [node-1] publish_address {192.168.1.222:9300}, bound_addresses {192.168.1.222:9300}
[2017-01-07T12:18:59,277][INFO ][o.e.b.BootstrapCheck ] [node-1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2017-01-07T12:19:03,447][INFO ][o.e.c.s.ClusterService ] [node-1] new_master {node-1}{8x-utN34QFqJmeeIhrTGjA}{euJKK9YNSSueCM__ko6O8Q}{192.168.1.222}{192.168.1.222:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-01-07T12:19:03,636][INFO ][o.e.h.HttpServer ] [node-1] publish_address {192.168.1.222:9200}, bound_addresses {192.168.1.222:9200}
[2017-01-07T12:19:03,636][INFO ][o.e.n.Node ] [node-1] started
[2017-01-07T12:19:03,637][INFO ][o.e.g.GatewayService ] [node-1] recovered [0] indices into cluster_state
[2017-01-07T12:23:04,309][INFO ][o.e.m.j.JvmGcMonitorService] [node-1] [gc][young][248][9] duration [723ms], collections [1]/[1s], total [723ms]/[1.7s], memory [72.1mb]->[37mb]/[505.6mb], all_pools {[young] [51.2mb]->[172.8kb]/[51.2mb]}{[survivor] [6.3mb]->[4.7mb]/[6.3mb]}{[old] [14.4mb]->[32.3mb]/[448mb]}
[2017-01-07T12:23:04,310][WARN ][o.e.m.j.JvmGcMonitorService] [node-1] [gc][248] overhead, spent [723ms] collecting in the last [1s]


浏览器打开网址:http://192.168.1.222:9200/ (出现当前集群节点信息)

{
"name" : "node-1",
"cluster_name" : "es_cluster",
"cluster_uuid" : "3DUO7WigT9m0pqMz-QlR4g",
"version" : {
"number" : "5.0.0",
"build_hash" : "253032b",
"build_date" : "2016-10-26T04:37:51.531Z",
"build_snapshot" : false,
"lucene_version" : "6.2.0"
},
"tagline" : "You Know, for Search"
}



参考:​​ Installing Elasticsearch​

​Elasticsearch 权威指南(中文版)​


标签:5.0,node,01,CentOS,07T12,INFO,Elasticsearch,elasticsearch,2017
From: https://blog.51cto.com/hzc2012/6007799

相关文章

  • Centos7 中安装Docker
    1.卸载旧版本(之前没有安装过的可以跳过)sudoyumremovedocker\docker-client\docker-client-latest\doc......
  • 使用 Elasticsearch 搭建自己的搜索系统,这个厉害了。。
    作者:HaiXiang来源:https://www.cnblogs.com/haixiang/p/12867160.html什么是elasticsearchElasticsearch是一个开源的高度可扩展的全文搜索和分析引擎,拥有查询近实时......
  • centos7 搭建nfs服务器及目录挂载
    服务端配置第一步:安装nfs服务器yuminstallnfs-utils-y如果已经安装过会有已经有该服务的提醒,如下   第二步:创建共享目录并赋予权限mkdir-p/fx/nfs......
  • Elasticsearch中的refresh和flush操作指南(es数据写入但是查询不到问题)
    在今天的文章里,我们来主要介绍一下Elasticsearch的refresh及flush两种操作的区别。如果我们从字面的意思上讲,好像都是刷新的意思。但是在Elasticsearch中,这两种操......
  • elasticsearch性能调优
    索引的创建需要配置mapping与setting两部分。索引的mapping常用数据类型text、keyword、number、array、range、boolean、date、geo_point、ip、nested、object。text:......
  • Elasticsearch查询调优
    前言一个系统查询慢往往是由多种因素造成的,在处理集群查询慢的问题上,先将问题分解。1)需要观察是系统哪种资源受限,例如内存、CPU或磁盘IO等,是否存在硬件瓶颈;2)要确定......
  • Centos7.6安装nodejs
    1.直接yuminstallnodejs安装后没有npm,搜索后说时要先执行curl--silent--locationhttps://rpm.nodesource.com/setup_10.x|bash-,再进行yuminstall,因内网环境就放......
  • Centos7 最小化安装网络配置
    Centos最小化安装真是”最小化”,什么都没有......
  • Centos7下安装Dogtail GUI自动化测试工具并打开sniff工具过程中遇到的问题解决方法
    (目录)因为测试需要,需在Centos下进行liunxGUI软件自动化测试,所以用到了python的Dogtail库,继而使用Dogtail的sniff控件获取工具,但是遇到了很多问题记录如下。1环境Cent......
  • AIDA64 v5.00.3300
    AIDA64是一款测试软硬件系统信息的工具可以详细的显示出PC的每一个方面的信息下载:​​​http://download.aida64.com/aida64extreme500.zip​​​http://download.aida64.co......