初识 Es(Elasticsearch)

Elasticsearch是什么? Elasticsearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java语言开发的,并作为Apache许可条款下的开放源码发布,是一种流行的企业级搜索引擎。

 

下载安装

本文只讲linux环境下的es搭建

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz
tar -zxvf elasticsearch-5.1.1.tar.gz
cd elasticsearch-5.1.1
修改limit限制
 vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
echo 'vm.max_map_count=262144'>> /etc/sysctl.conf
sysctl -p
vi /etc/security/limits.d/90-nproc.conf
          soft    nproc     2048

设置配置文件

vim config/elasticsearch.yml
node.name: node-1
path.data: /tmp/elasticsearch/data
path.logs: /tmp/elasticsearch/logs
network.host: 192.168.x.x
http.port: 9200
# 跨域
http.cors.enabled: true
http.cors.allow-origin: "*"

创建用户

groupadd elasticsearch
useradd elasticsearch -g elasticsearch -p elasticsearch
# 赋权限
chown elasticsearch:elasticsearch -R /usr/local/elasticsearch-5.1.1
启动
su - elasticsearch -c "nohup /usr/local/elasticsearch-5.1.1/bin/elasticsearch >/dev/null 2>&1 &"

具体路径大家根据自己实际情况更改。

 

Window

:点击ElasticSearch下的bin目录下的elasticsearch.bat启动

linux : 直接执行 bin下的 ./elasticsearch  

如图就是启动成功了

 

默认端口为9200

 

安装图形化插件(linux)

 

//如果没有npm,则需安装npm ,nodejs
yum install -y nodejs
curl https://npmjs.org/install.sh | sh
sh install.sh

git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install grunt --save
npm install
//启动服务
/usr/local/elasticsearch-head/node_modules/grunt/bin/grunt server

 

进入head插件目录,打开cmd,输入: npm install grunt server 打开浏览器,输入http://localhost:9100即可

 

接下来就可以用Restful接口直接访问,具体看我下一篇文章~~~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值