elasticsearch 使用记录

一、服务启动

1. 启动

ps -ef | grep elastic  # 查找进程

kill -9 2382(进程号)# 杀死进程

elasticsearch -d # 加d后台启动,

2.检测是否成功启动

在浏览器中输入:http://localhost:9200/

如果打印如下内容,则成功。

 

 

二、安装elasticsearch-head

先安装node

brew install node

npm下载插件,然后安装

git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install #安装elasticsearch依赖包
npm install -g grunt -cli #安装grunt
grunt server #启动服务

然后去修改elasticsearch的配置文件,elasticsearch安装目录/config/elasticsearch.yml,打开文件后在末端加入如下内容,保存后重启elasticsearch

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"

 

 

服务启动后,在浏览器中输入:http://localhost:9100/  

 

 

 

 

posted @ 2022-08-10 18:08  suwenyuan  阅读(26)  评论(0编辑  收藏  举报