ElasticSearch安装(for lynn)

1.安装java

# 安装jre
sudo yum install java-1.8.0-openjdk.x86_64
# 安装jdk
sudo yum install java-1.8.0-openjdk-devel

2.下载并安装ES

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.rpm

sudo rpm -ivh elasticsearch-1.7.3.noarch.rpm
安装目录:/usr/share/elasticsearch/
配置文件位置:/etc/elasticsearch
启动脚本:/etc/init.d/elasticsearch

3.设置自动启动

sudo systemctl enable elasticsearch.service

4.配置文件

所有配置:elasticsearch.yml
日志配置:logging.yml
日志文件位置:/var/log/elasticsearch

5.打开端口

firewall-cmd --zone=public --permanent --add-port=9200/tcp firewall-cmd --reload

BigDesk Plugin : 对集群中es状态进行监控。
Elasticsearch Head Plugin: 对ES进行各种操作,如查询、删除、浏览索引等。

https://blog.csdn.net/sinat_28224453/article/details/51134978

生产环境配置建议 https://blog.csdn.net/thomas0yang/article/details/55518105

简单操作

添加
PUT localhost:8083/jdthink/users/102 BODY

{
	"name":"cx2",
	"age":19,
	"sex":1
}

获取
GET localhost:8083/jdthink/users/102
统计
localhost:8083/_cat/indices

添加新类型
Rejecting mapping update to [jdthink] as the final mapping would have more than 1 type: [news, users]

put /jdthink/news/111
{
  "title":"建设世界科技强国 看习近平十大关键词",
  "content": "[学习进行时]5月28日,习近平总书记出席两院院士大会并发表重要讲话。他强调,中国要强盛、要复兴,就一定要大力发展科学技术,努力成为世界主要科学中心和创新高地。如何建设世界科技强国?习近平提出了哪些要求?新华社《学习进行时》原创品牌栏目“讲习所”今天推出文章,为您解读。"
}

猜你喜欢

转载自my.oschina.net/u/1240907/blog/1822018