linux 安装 es

创建用户

从5.0开始,ElasticSearch 安全级别提高了,不允许采用root帐号启动,所以我们要添加一个用户

1 创建 elasticsearch 用户组

root@localhost ~]# groupadd elasticsearch

2 创建用户 es 并设置密码为es

[root@localhost ~]# useradd es
[root@localhost ~]# passwd es

3 用户es 添加到 elasticsearch 用户组

[root@localhost ~]# usermod -G elasticsearch es

4 设置sudo权限

[root@localhost ~]# visudo
在root ALL=(ALL) ALL 一行下面
添加es用户 如下:
es ALL=(ALL) ALL

添加成功保存后切换到es用户操作

[root@localhost ~]# su es
[es@localhost root]$

下载安装包

[es@localhost src]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.tar.gz
[es@localhost src]$ tar -xvf elasticsearch-5.5.2.tar.gz

把解压的文件移动到 /usr/local

[es@localhost src]$ sudo mv elasticsearch-5.5.2 /usr/local

更改elasticsearch-5.5.2 文件夹以及内部文件的所属用户为es, 用户组组为elasticsearch,-R表示逐级

[es@localhost local]$ sudo chown -R es:elasticsearch elasticsearch-5.5.2

ElasticSearch 配置

elasticsearch.yml 修改

[es@localhost elasticsearch-6.3.2]$ vim config/elasticsearch.yml

cluster.name: my-application

node.name: node-1

network.host: 0.0.0.0 

http.port: 9200

#因为Centos6不支持SecComp,而ES默认bootstrap.system_call_filter为true进行检测

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

修改/etc/sysctl.conf 

切换回root 用户 执行

vim /etc/sysctl.conf

在文件最后面添加内容:

vm.max_map_count=262144

保存退出后,使用sysctl -p 刷新生效。

修改文件/etc/security/limits.conf

vim /etc/security/limits.conf

添加如下内容:

* hard nofile 65536
* soft nofile 65536
* soft nproc 2048
* hard nproc 4096

启动elasticesearch 可能还会报如下错误

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

解决:切换到root用户,进入limits.d目录下修改配置文件。

vi /etc/security/limits.d/90-nproc.conf

修改如下内容:

soft nproc 1024

#修改为

soft nproc 4096

启动 elasticsearch

完成上面配置修改后,切换到es 用户,目录切换到 elasticsearch 安装目录下执行

bin/elasticsearch

在浏览器输入localhost:9200 验证是否启动成功

设置中文分词 

https://www.cnblogs.com/yanketao/p/10967181.html

posted on 2019-06-06 10:29 三天打鱼,两天晒网 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/yanketao/p/10983556.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 您可以参考官方文档来安装Elasticsearch:https://www.elastic.co/guide/cn/elasticsearch/reference/current/install-elasticsearch.html。 ### 回答2: 要在Linux安装Elasticsearch,可以按照以下步骤进行: 1. 首先,确保已经安装了Java Runtime Environment(JRE),因为Elasticsearch是用Java编写的。可以通过运行命令`java -version`来验证JRE的安装情况。 2. 接下来,前往Elasticsearch的官方网站(https://www.elastic.co/products/elasticsearch)下载适用于Linux安装包。根据你的系统架构选择下载64位或32位版本。 3. 下载完成后,解压缩压缩包。可以使用命令`tar -xf elasticsearch-x.x.x.tar.gz`来解压缩。这将会创建一个名为elasticsearch-x.x.x的目录。 4. 进入解压后的目录,然后打开config文件夹,编辑elasticsearch.yml文件,根据你的需求进行必要的配置更改,如监听端口、集群名称等。 5. 保存并关闭elasticsearch.yml文件后,你可以启动Elasticsearch。在命令行中切换到elasticsearch-x.x.x目录,然后运行`./bin/elasticsearch`命令。 6. 启动后,Elasticsearch会在后台运行,并通过默认端口9200提供RESTful API接口。可以通过在浏览器中访问`http://localhost:9200`来验证安装成功。 以上就是在Linux安装Elasticsearch的基本步骤。根据具体情况,还可以进行其他配置(如内存限制、集群配置等),以满足特定需求。 ### 回答3: 要在Linux安装Elasticsearch,首先需要确保你的系统满足所需的要求。Elasticsearch需要Java环境,因此请确保你已经安装了Java Development Kit(JDK)。 安装步骤如下: 1. 首先,更新你的系统: sudo apt update 2. 安装JDK: sudo apt install default-jdk 3. 验证JDK的安装: java -version 如果能够打印出Java的版本信息,说明JDK已经正确安装。 4. 下载Elasticsearch: 在Elasticsearch的官方网站上下载最新版本的压缩包,或者通过命令行下载: wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.4-linux-x86_64.tar.gz 5. 解压缩文件: tar -xzf elasticsearch-7.13.4-linux-x86_64.tar.gz 6. 进入解压缩后的目录: cd elasticsearch-7.13.4 7. 启动Elasticsearch: ./bin/elasticsearch Elasticsearch将会启动,并在后台运行。 8. 验证Elasticsearch的安装: 使用curl命令或者浏览器访问以下URL来验证Elasticsearch是否成功启动: curl -X GET "http://localhost:9200" 如果能够得到类似下面的响应,说明Elasticsearch已经安装并运行正常: { "name" : "your-machine-name", "cluster_name" : "elasticsearch", "cluster_uuid" : "xxxxxx", "version" : { "number" : "7.13.4", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "xxxxxx", "build_date" : "xxxxxx", "build_snapshot" : false, "lucene_version" : "xxxxxx", "minimum_wire_compatibility_version" : "xxxxxx", "minimum_index_compatibility_version" : "xxxxxx" }, "tagline" : "You Know, for Search" } 恭喜!现在你已经成功在Linux安装了Elasticsearch。你可以通过编辑配置文件`./config/elasticsearch.yml`来配置Elasticsearch的相关设置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值