elasticsearch安装

  1. 安装,去es官网下载安装包,解压就是安装.

下载链接:https://www.elastic.co/downloads/elasticsearch

需要注意的就是操作系统位数好像有关系,一开始在32位的centos上安装没成功,最后转移到了mac上。

  1. 启动:进入es目录下的bin,执行

./elasticsearch –d(-d表示后台执行)

注意es默认是不能用root用户启动的,所以得新建用户进行启动

  1. 验证

执行curl http://127.0.0.1:9200(返回json串)

  1. 关闭服务

mac:lsof –I tcp:9200(查询端口占用的pid)

        kill pid

win:netstat –nao|findstr 9200

        taskkill –F –pid [pid]

  1. 安装elasticsearch-head:
    1. 安装elasticsearch-head是一款开源组件,被托管在github上面,想使用必须先安装git(拉取地址:git://github.com/mobz/elasticsearch-head.git)
    2. 运行head会用到grunt,grunt需要npm包管理器,所以需要安装nodejs
    3. 在head上层目录执行

npm install –g grunt-cli(local目录下)

cd /usr/local/elasticsearch-head

cnpm install

这块会提示cnpm没有这个命令,百度下载方式

    1. vi gruntfile.js

在connect->server->options下面添加:hostname:”*”,允许所有ip访问

    1. 配置es->config下的elasticsearch.yml

后面加上

     http.cors.enables: true

     http.cors.allow-origin: “*”

  1. 启动es
  2. 进入es-head执行:npm run start(启动head)
  3. 访问9100端口

注意:本次安装是在mac下进行的,如果在服务器上需要开放端口

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值