ElsaticSearch安装

与传统数据库之间的关系
MysqlElasticSearch
数据库索引(Index)
类型(Type)
文档(Document)
字段(Fields)

一、ElasticSearch安装

在官网下载elasticsearch安装包

elasticsearch官网下载地址

解压

将下载好的tar.gz解压导非root用户下

启动
./bin/elasticsearch
注意,可能出现的问题
1、max virtual memory areas vm.maxmapcount [65530] is too low
解决办法
执行以下命令
sudo sysctl -w vm.max_map_count=262144
1、max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
解决办法

切换到root用户修改

vim /etc/security/limits.conf
在最后面追加下面内容
*** hard nofile 65536
*** soft nofile 65536
***  是启动ES的用户
查看运行状态

如果一切正常,Elastic 就会在默认的9200端口运行。这时,打开另一个命令行窗口,请求该端口,会得到说明信息。

Last login: Tue Nov 27 15:45:43 2018 from 10.4.16.221
[ocetl@yxd ~]$  curl localhost:9200
{
  "name" : "Co8jWPC",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "LVSr1P32SNG9ySN11vYrPQ",
  "version" : {
    "number" : "6.5.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "8c58350",
    "build_date" : "2018-11-16T02:22:42.182257Z",
    "build_snapshot" : false,
    "lucene_version" : "7.5.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
[ocetl@yxd ~]$ 

按下 Ctrl + C,Elastic 就会停止运行。

上面代码中,请求9200端口,Elastic 返回一个 JSON 对象,包含当前节点、集群、版本等信息。
默认情况下,Elastic 只允许本机访问,如果需要远程访问,可以修改 Elastic 安装目录的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改成0.0.0.0,然后重新启动 Elastic。

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.

注意:上面代码中,设成0.0.0.0让任何人都可以访问。线上服务不要这样设置,要设成具体的 IP。
将networkhost的值修改之后我们可以在浏览器中访问elasticsearch了


12041621-bf2e1a2fe638b530.png

二、基本说明

Node与Claster

Elastic本质上是一种分布式数据库,允许多台服务器系统工作,每台服务器上也可以运行多个Elastic实例。
单个Elsatic成为一个节点(Node),一组具有相同cluster.name的节点成为集群(Claster)。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值