Elasticsearch 7.3.0版本学习笔记-下载与安装

Elasticsearch 7.3.0版本学习笔记

Elasticsearch 是一个基于JSON的分布式搜索和分析引擎。

Elasticsearch 官网地址:https://www.elastic.co/cn/elastic-stack/

## 下载与安装

Elasticsearch Linux版 下载地址:https://www.elastic.co/cn/downloads/past-releases/,本文下载7.3.0版本

解压

```shell
[root@centos7 ~]# tar -zvxf elasticsearch-7.3.0-linux-x86_64.tar.gz
```

移动到/usr/local目录下

```shell
[root@centos7 ~]# mv elasticsearch-7.3.0 /usr/local
```

更改名字

```shell
[root@centos7 local]# mv elasticsearch-7.3.0/ elasticsearch
```

进入到elasticsearch 目录

```shell
[root@centos7 ~]# cd /usr/local/elasticsearch-7.3.0/
```

## 配置

```shell
# 修改network.host的配置为0.0.0.0,让外网可以访问
[ajtuser@centos7 elasticsearch]$ vim ./config/elasticsearch.yml 

network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
#http.port: 9200
```

## 启动(用非root账号启动)

```shell
# 启动报错
[ajtuser@centos7 elasticsearch]$ ./bin/elasticsearch
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

```

```shell

[root@centos7 ~]# vim /etc/security/limits.conf 
在/etc/security/limits.conf文件中新增如下配置
*  soft  nofile  65536
*  hard  nofile  65536
*  soft  nproc   4096
*  hard  nproc   4096

[root@centos7 ~]# vim /etc/sysctl.conf
在/etc/sysctl.conf文件中新增如下配置
vm.max_map_count=262144

# 使配置生效
[root@centos7 ~]# sysctl -p

用户切换,使以上配置生效

浏览器输入http://192.168.100.206:9200

{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "hl1I3JV9Sc6Xovzjebd4Bw",
  "version" : {
    "number" : "7.3.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "de777fa",
    "build_date" : "2019-07-24T18:30:11.767338Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

```

## kibana 

>  为了方便学习elasticsearch,最好安装一下kibana,kibana版本最好与elasticsearch保持一致
>
> 下载地址:https://www.elastic.co/cn/downloads/kibana

解压

```shell
[ajtuser@centos7 ~]$ tar -zvxf kibana-7.3.0-linux-x86_64.tar.gz
```

移动到/usr/local目录下,并重命名

```shell
[ajtuser@centos7 ~]$ mv kibana-7.3.0-linux-x86_64 /usr/local/
[ajtuser@centos7 local]$ mv kibana-7.3.0-linux-x86_64/ kibana
```

修改kibana的配置

```shell
[ajtuser@centos7 kibana]$ vim config/kibana.yml 
# 设置如下内容
# 指定服务运行的端口,默认是5601
server.port: 5601
# 允许外网访问,默认是只允许localhost访问
server.host: 0.0.0.0
# 指定连接elasticsearch的hosts 默认是http://localhost:9200
elasticsearch.hosts: ["http://localhost:9200"]
```

启动elasticsearch成功后,再启动kibana

```shell
[ajtuser@centos7 kibana]$ ./bin/kibana
```

访问

http://192.168.100.206:5601 

> 说明:kibana的启动也不能是root账号,若启动成功不能访问,检查防火墙是否关闭
>
> centos7 暂停防火墙命令,但是服务重启后防火墙会启动
>
> systemctl stop firewalld.service
>
> centos7 永久关闭防火墙
>
> systemctl disable firewalld.servic

上一篇:elasticsearch 学习笔记-kibana


下一篇:Docker 安装 ELK