centos7 安装 elasticsearch
安装java环境
这里使用yum方式安装,前提是必须有网络
yum install java-1.8.0-openjdk
安装完成,查看java版本
[root@localhost ~]# java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
安装 Elasticsearch
Elasticsearch的安装很简单,下载下来解压即可,这里使用wget下载,当然也可通过网页下载 https://www.elastic.co/downloads/elasticsearch ,再拷贝。
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.tar.gz
解压到/usr/local/
tar -zxvf elasticsearch-5.6.3.tar.gz -C /usr/local/
运行Elasticsearch
Elasticsearch 要求不能使用超级用户root运行,所以我们建立一个testuser账号
# 创建testuser账户
adduser testuser
# 修改密码
passwd testuser
然后,给testuser用户elasticsearch目录的授权。
chown -R testuser /usr/local/elasticsearch-5.6.3/
切换至elasticsearch目录,并以testuser用户运行
cd /usr/local/elasticsearch-5.6.3/
su testuser
运行elasticsearch,如果想后台运行后面加 -d
[testuser@localhost elasticsearch-5.6.3]$ ./bin/elasticsearch
[2017-10-31T16:07:09,445][INFO ][o.e.n.Node ] [] initializing ...
[2017-10-31T16:07:09,662][INFO ][o.e.e.NodeEnvironment ] [oDFU6c3] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [45.4gb], net total_space [49.9gb], spins? [unknown], types [rootfs]
[2017-10-31T16:07:09,662][INFO ][o.e.e.NodeEnvironment ] [oDFU6c3] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-10-31T16:07:09,663][INFO ][o.e.n.Node ] node name [oDFU6c3] derived from node ID [oDFU6c3UT6ORC2p0CKBeLA]; set [node.name] to override
[2017-10-31T16:07:09,663][INFO ][o.e.n.Node ] version[5.6.3], pid[11484], build[1a2f265/2017-10-06T20:33:39.012Z], OS[Linux/3.10.0-514.26.2.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_151/25.151-b12]
[2017-10-31T16:07:09,664][INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/local/elasticsearch-5.6.3]
[2017-10-31T16:07:10,723][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [aggs-matrix-stats]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [ingest-common]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [lang-expression]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [lang-groovy]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [lang-mustache]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [lang-painless]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [parent-join]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [percolator]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [reindex]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [transport-netty3]
[2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [transport-netty4]
[2017-10-31T16:07:10,725][INFO ][o.e.p.PluginsService ] [oDFU6c3] no plugins loaded
[2017-10-31T16:07:12,622][INFO ][o.e.d.DiscoveryModule ] [oDFU6c3] using discovery type [zen]
[2017-10-31T16:07:13,133][INFO ][o.e.n.Node ] initialized
[2017-10-31T16:07:13,133][INFO ][o.e.n.Node ] [oDFU6c3] starting ...
[2017-10-31T16:07:13,306][INFO ][o.e.t.TransportService ] [oDFU6c3] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-10-31T16:07:13,318][WARN ][o.e.b.BootstrapChecks ] [oDFU6c3] max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2017-10-31T16:07:16,372][INFO ][o.e.c.s.ClusterService ] [oDFU6c3] new_master {oDFU6c3}{oDFU6c3UT6ORC2p0CKBeLA}{olaY-n5LTpCUpzrhU3joVw}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-10-31T16:07:16,398][INFO ][o.e.h.n.Netty4HttpServerTransport] [oDFU6c3] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-10-31T16:07:16,399][INFO ][o.e.n.Node ] [oDFU6c3] started
[2017-10-31T16:07:17,242][INFO ][o.e.g.GatewayService ] [oDFU6c3] recovered [0] indices into cluster_state
如果没有没有error,就运行成功啦
新开一个终端,用curl访问
[root@localhost ~]# curl 'http://localhost:9200/?pretty'
{
"name" : "oDFU6c3",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "v2mGsAuuTsqIzzm8CZcW5w",
"version" : {
"number" : "5.6.3",
"build_hash" : "1a2f265",
"build_date" : "2017-10-06T20:33:39.012Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}
其他配置
elasticsearch指定ip地址
编辑es的配置文件
[testuser@localhost elasticsearch-5.6.3]$ vim ./config/elasticsearch.yml
找到network.host: 一行,去除#号,修改为:
network.host: [_local_, 172.30.6.1]
172.30.6.1为指定的ip地址,可以是多个。
这样就可以在浏览器里打开啦
http://172.30.6.1:9200/?pretty
可能遇到的问题
问题一
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
max_map_count 的值是指一个进程最多可用于的内存映射区(memory map areas),在调用malloc会用到,由mmap/mprotect生成。
解决办法:
切换到root用户修改配置/etc/sysctl.conf
su root
vim /etc/sysctl.conf
加入
vm.max_map_count=655360
然后使其生效
sysctl -p
问题二
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
文件描述符太低
解决办法:
切换到root用户修改/etc/security/limits.conf
su root
vim /etc/security/limits.conf
加入
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
问题三
使用supervisor启动时,查看日志仍然报下面的错误
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
解决办法:
切换到root用户修改vim /etc/supervisord.d/elasticsearch.conf
[supervisord]
minfds=65536
minprocs=32768 [program:es]
process_name=%(program_name)s_%(process_num)02d
directory=/usr/local/elasticsearch-5.6.3/
command=/usr/local/elasticsearch-5.6.3/bin/elasticsearch
;autostart=true
autorestart=false
user=testuser
numprocs=1
centos7 安装 elasticsearch的更多相关文章
- Centos7安装elasticsearch、logstash、kibana、elasticsearch head
环境:Centos7, jdk1.8 安装logstash 1.下载logstash 地址:https://artifacts.elastic.co/downloads/logstash/logsta ...
- centos7安装Elasticsearch及Es-head插件详细教程(图文)
懒惰了很久,今天来写一下Elasticsearch在centos7上安装教程以及安装过程中可能出现的报错解决方式,有不对的地方,烦请各位看官多多指教! 一.ES安装 1.环境检查 确保有java环境, ...
- centos7 安装elasticsearch
[root@localhost local]# tar xzvf elasticsearch-2.3.5.tar.gz [root@localhost elasticsearch-2.3.5]# bi ...
- Centos7安装Elasticsearch和Kibana
这里使用的6.6.0版本,ES需要JDK环境,对应1.8 Elasticsearch安装: 1.下载:https://elasticsearch.cn/download/ 2.解压: 3.修改配置:j ...
- centos7安装elasticsearch
[root@aaron tools]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.zi ...
- centos7环境安装ElasticSearch
操作系统: Centos7 .64位 ========================================= 查看系统版本和系统位数: [root@localhost /]# cat /e ...
- Centos7下安装Elasticsearch 5.6.6
环境 因为elasticsearch是用java编写的,所以需要先安装JDK ES 5,安装需要 JDK 8 以上ES 6.5,安装需要 JDK 11 以上ES 7.2.1,内置了 JDK 12 安装 ...
- 【elasticsearch】(2)centos7 超简单安装elasticsearch 的监控、测试的集群工具elasticsearch head
elasticsearch-head是elasticsearch(下面称ES)比较普遍使用的可监控.测试等功能的集群管理工具,是由H5编写的单独的网页程序.使用方法网上很多,这里教大家一个超简单安装h ...
- ElasticSearch(一):CentOS7 安装 ElasticSearch6.4.0
一.安装jre支持 在CentOS中安装ElasticSearch需要Java1.8.0,可执行命令# java -version查看当前系统所安装Java版本是否为1.8.0版本. 若非1.8.0 ...
随机推荐
- sqlyog注册码
姓 名(Name):ttrar 序 列 号(Code):8d8120df-a5c3-4989-8f47-5afc79c56e7c或者(OR)姓 名(Name):ttrar序 列 号(C ...
- python 列表元素的筛选
color = ['Red', 'Green', 'White', 'Black', 'Pink', 'Yellow'] color = [x ,,)] print(color)
- vue 脚手架(二,项目依赖说明 package.json)
本文以转移至本人的个人博客,请多多关注! 本文以转移至本人的个人博客,请多多关注! 本文以转移至本人的个人博客,请多多关注! 本文以转移至本人的个人博客,请多多关注! 继续上一篇, 上一篇讲了 vue ...
- Tensorflow一些常用基本概念与函数(四)
摘要:本系列主要对tf的一些常用概念与方法进行描述.本文主要针对tensorflow的模型训练Training与测试Testing等相关函数进行讲解.为‘Tensorflow一些常用基本概念与函数’系 ...
- [学习笔记]ST表
ST表 给定一个数列$a,O(nlogn)$预处理,$O(1)$查询数列在区间$[l,r]$的最值. 本文介绍求最大值. 实现 预处理 $st[i][j]$表示$max\{a_k\}(k\in[i,i ...
- hive row_number等窗口分析函数
一.排序&去重分析 row_number() over(partititon by col1 order by col2) as rn 结果:1,2,3,4 rank() over(parti ...
- spring boot: 热部署(一) run as – java application (spring-loader-1.2.4.RELEASE.jar)
spring boot: 热部署(一) run as – java application (spring-loader-1.2.4.RELEASE.jar) 如果使用的run as – java a ...
- hihocoder1513
https://hihocoder.com/problemset/problem/1513 五维偏序问题,直接bitset压位,复杂度O(n^2/32) (本来想写三维偏序,但是cdq不会只好写写五维 ...
- 移动web开发适配方案之Rem
移动端为什么要做适配 移动端相对PC端来说大部分浏览器内核都是基于Webkit的,所以大部分都支持CSS3的最新语法.但是由于手机的屏幕尺寸和分辨率都不太一样(尤其是安卓),所以不得不对不同分辨率的手 ...
- sgu 147. Black-white king 思路 坑 难度:1
147. Black-white king time limit per test: 0.25 sec.memory limit per test: 4096 KB input: standard i ...