Linux下安装Elasticsearch

系统环境

  • jdk 11
  • CentOS7
  • Elasticsearch7.2.0

jdk安装

Elasticsearch的运行依赖于java
这里安装Elasticsearch7.2.0对应jdk的版本是11。
自行在官网下载jdk。
jdk安装教程在此:https://blog.csdn.net/NetRookieX/article/details/90321819


ES安装

1.下载Elasticsearch

官方地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch (这里要下载7.2.0)

解压Elasticsearch至/opt。

2.安装与配置
vi /etc/sysctl.conf
	vm.max_map_count=655360
sysctl -p
vi /etc/security/limits.conf
	* soft nofile 65536
	* hard nofile 131072
	* soft nproc 65536
	* hard nproc 131072
vi /etc/security/limits.d/20-nproc.conf
	elk    soft    nproc     65536
useradd elk
mkdir  -pv  /opt/elk/{data,logs}
chown -R elk:elk /opt/elk/
chown -R elk:elk /opt/elasticsearch-7.2.0
vim /opt/elasticsearch-7.2.0/config/elasticsearch.yml
	cluster.name: my-application
	node.name: node-1
	path.data: /opt/elk/data
	path.logs: /opt/elk/logs
	network.host: 192.168.191.128		#ES监听的ip
	http.port: 9200									#ES监听的端口
	cluster.initial_master_nodes: ["node-1"]
firewall-cmd --add-port=9200/tcp --per
firewall-cmd --add-port=9200/tcp
reboot		#重启
cd /opt/elasticsearch-7.2.0
su elk		#在elk用户下启动ES
./bin/elasticsearch -d		#启动ES(-d为后台启动)
3.验证
curl 192.168.191.128:9200

输出以下内容即安装成功:

{
“name” : “node-1”,
“cluster_name” : “my-application”,
“cluster_uuid” : “l8SuqhMfQkSKaOgJ6Uc4Ww”,
“version” : {
“number” : “7.2.0”,
“build_flavor” : “default”,
“build_type” : “tar”,
“build_hash” : “508c38a”,
“build_date” : “2019-06-20T15:54:18.811730Z”,
“build_snapshot” : false,
“lucene_version” : “8.0.0”,
“minimum_wire_compatibility_version” : “6.8.0”,
“minimum_index_compatibility_version” : “6.0.0-beta1”
},
“tagline” : “You Know, for Search”
}


分词器-ik安装

分词器是将存储进去的文档进行短语拆分处理,用来作为查询索引。
原生的分词器对于中文的分词支持不是很好。(将"人民币"分为"人"、“民”、“币”)

1.下载ik
查看与ES对应的ik版本:https://github.com/medcl/elasticsearch-analysis-ik/blob/master/README.md
下载ik:https://github.com/medcl/elasticsearch-analysis-ik/releases
2.安装ik
mkdir /opt/elasticsearch-7.2.0/plugins/ik
cd /opt/elasticsearch-7.2.0/plugins/ik		#将ik解压至此
reboot
启动ES

posted @ 2020-02-22 21:00  NetRookieX  阅读(7)  评论(0编辑  收藏  举报