elasticsearch7.8 安装及部署

因为项目上使用了elasticsearch7作为搜素引擎,为了方便学习和理解在本机的Centos7虚拟机上安装elasticsearch7最新版试一试,现将安装及调试步骤记录。

一、下载

下载地址:https://www.elastic.co/cn/downloads/elasticsearch,我选择下载LINUX X86_64版本。

二、解压

1、通过XSHELL把文件复制到LINUX的/usr/local目录。

2、解压缩:tar -zxvf elasticsearch-7.8.0-linux-x86_64.tar.gz

三、配置外网访问URL(bigdata1)

1、vim elasticsearch-7.8.0/config/elasticsearch.yml 修改network.host: bigdata1

2、运行elasticsearch会报错,对应修改如下:

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

vim /etc/security/limits.conf文件,添加

* soft nofile 65535

* hard nofile 65535

[2]: max number of threads [3818] for user [admin] is too low, increase to at least [4096]
vim /etc/security/limits.conf文件,添加

* soft nproc  4096
* hard nproc  4096


[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vim /etc/sysctl.conf 文件,添加

vm.max_map_count=262144  

[4]: 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

vim /usr/local/elasticsearch/elasticsearch-7.0.0/config/elasticsearch.yml 文件,添加

cluster.initial_master_nodes: ["node-1"]
修改后重启LINUX

四、修改用户权限,否则会报错(can not run elasticsearch as root)

1、创建elsearch用户组及elsearch用户

     groupadd elsearch

     useradd elsearch -g elsearch

     passwd elsearch

2、更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch

     cd /usr/local

     chown -R elsearch:elsearch elasticsearch-7.8.0

3、切切换到elsearch用户再启动

     su elsearch

     cd /usr/local/elasticsearch-7.8.0/bin

     ./elasticsearch

四、通过http://bigdata1:9200/访问显示如下:

 

{
  "name" : "BigData1",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "ZFF9-r7YTG6DLTTzpBUHsw",
  "version" : {
    "number" : "7.8.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65",
    "build_date" : "2020-06-14T19:35:50.234439Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

五、关掉elasticsearch

ps | grep elasticsearch #查到进程

kill -9 pid #杀掉进程

 

 

你可能感兴趣的:(elasticsearch,Linux,elasticsearch,linux,centos)