elasticsearch安装

10 篇文章 0 订阅
2 篇文章 0 订阅

1. 安装

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz

tar -xvzf elasticsearch-6.2.3.tar.gz

使用非root账号运行

adduser es
passwd es

然后输入密码
创建成功后

chown -R es:es elasticsearch-6.2.3
su es

2. 配置

cd elasticsearch-6.2.3/config
vim elasticsearch.yml

根据需要配置

network.host: 0.0.0.0   #允许任意ip访问

3. 运行

cd elasticsearch-6.2.3/bin
bin/elasticsearch 

后台运行

nohup ./elasticsearch > elasticLog.log &
或
bin/elasticsearch -d

浏览器访问

ip地址:端口号   #端口号默认9200

返回一下内容表示启动成功

{
  "name" : "nQjQYj2",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "h7oqDUO1Q8me_iSdN1ztag",
  "version" : {
    "number" : "6.2.3",
    "build_hash" : "c59ff00",
    "build_date" : "2018-03-13T10:06:29.741383Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

4. 可能出现的问题和解决方法

1. system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
  • 问题原因:因为Centos6不支持SecComp,而ES5.2.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。详见:https://github.com/elastic/elasticsearch/issues/22899

  • 解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false
2. max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]

max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]

  • 解决方法:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf

添加如下内容:

soft nofile 65536
hard nofile 131072
soft nproc 2048
hard nproc 4096
3. max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
  • 解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf

修改如下内容:

soft nproc 1024

修改为

soft nproc 2048
4. max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
  • 解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p
安装Elasticsearch,你可以按照以下步骤进行操作: 1. 首先,你可以从官方网站下载Elasticsearch安装包。官网下载地址为。 2. 下载完成后,解压缩安装包。你可以使用以下命令解压缩tar.gz文件: ```shell tar -zxvf elasticsearch-7.8.1-linux-x86_64.tar.gz ``` 3. 解压缩完成后,进入解压缩后的目录,找到配置文件elasticsearch.yml。你可以使用以下命令来编辑该文件并进行配置: ```shell vim /usr/local/elasticsearch-7.13.2/config/elasticsearch.yml ``` 4. 在编辑配置文件之前,你可能需要了解一些配置选项以满足你的需求。根据你的环境和需求,修改elasticsearch.yml文件中的配置选项。 5. 当你完成了配置文件的修改后,保存并退出编辑器。 6. 现在,可以启动Elasticsearch了。你可以使用以下命令启动Elasticsearch: ```shell ./bin/elasticsearch ``` 这是一个基本的安装和启动Elasticsearch的过程。请注意,具体的步骤可能因操作系统和版本而略有不同。确保你仔细阅读官方文档以获取更详细的安装指南。 关于卸载Elasticsearch,你可以按照以下步骤进行操作: 1. 首先,你可以通过以下命令来查看已安装Elasticsearch软件包: ```shell dpkg -l | grep elastic ``` 2. 接下来,你可以使用以下命令查找Elasticsearch安装关联: ```shell dpkg -L elasticsearch ``` 3. 然后,使用以下命令来移除已安装Elasticsearch软件包: ```shell dpkg -P elasticsearch ``` 4. 继续使用以下命令查找未卸载的目录和文件: ```shell find ./elasticsearch | grep elasticsearch ``` 注意:根据你的环境和安装方式,可能会有其他目录和文件与Elasticsearch相关。 5. 最后,根据你的环境,使用以下命令来移除相关的目录和文件: ```shell rm -r /var/lib/elasticsearch rm /var/lib/dpkg/info/elasticsearch.* rm /etc/default/elasticsearch rm /etc/init.d/elasticsearch ``` 请根据自己的具体环境和需求来执行移除目录和文件的操作,确保操作正确无误。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [一、ElasticSearch安装](https://blog.csdn.net/m0_51295655/article/details/123193074)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值