Skip to content
Menu
小小述博客
  • 首页
  • Nginx
  • Php
  • Laravel
  • Git
  • 在线工具
  • 资源下载
  • Magento2
小小述博客
2022年12月2日2023年1月11日

Elasticsearch 安装与卸载

Post Views: 306

1. Elasticsearch 安装

1.1 添加普通用户ben到sudo

adduser ben
[root@ip-172-31-8-38 ~]# id benuid=1001(ben) gid=1001(ben) groups=1001(ben)
[root@ip-172-31-8-38 ~]# usermod -a -G wheel ben
[root@ip-172-31-8-38 ~]# id benuid=1001(ben) gid=1001(ben) groups=1001(ben),10(wheel)
[root@ip-172-31-8-38 ~]# sudo passwd benChanging password for user ben.

1.2 安装 Elasticsearch

官方安装地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.13/rpm.html#rpm-running-systemd

进入系统根目录下面的 local ,在普通用户(ben) 下面执行安装操作:

###下载
cd /local
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.4-x86_64.rpm
sudo wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.4-x86_64.rpm.sha512 shasum -a 512 -c elasticsearch-7.13.4-x86_64.rpm.sha512
###安装
sudo rpm --install elasticsearch-7.13.4-x86_64.rpm
warning: elasticsearch-7.13.4-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Creating elasticsearch group... OK
Creating elasticsearch user... OK
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
### 安装时不启动,请执行以下语句将elasticsearch服务配置为使用systemd自动启动
 sudo systemctl daemon-reload
 sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
 sudo systemctl start elasticsearch.service
Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore

安装如下图所示:

1.3 常见使用命令

要配置Elasticsearch以在系统启动时自动启动,请运行以下命令:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

Elasticsearch可以按以下方式启动和停止:

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

检查Elasticsearch是否运行

您可以通过向以下端口发送 HTTP 请求来测试您的 Elasticsearch 节点是否正在9200运行localhost:

curl -X GET "localhost:9200/?pretty"

正常结果:

[ben@ip-172-31-8-38 local]$ curl -X GET "localhost:9200/?pretty"
{
  "name" : "ip-172-31-8-38.eu-central-1.compute.internal",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "EISWOsRkSkaFu2XIS-OUIg",
  "version" : {
    "number" : "7.13.4",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "c5f60e894ca0c61cdbae4f5a686d9f08bcefc942",
    "build_date" : "2021-07-14T18:33:36.673943207Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.2",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

2. 卸载Elasticsearch

ben@ip-172-31-2-29 src]$ rpm -qa |grep elasticsearch
 
rpm -qa |grep elasticsearch
elasticsearch-7.13.4-1.x86_64
[ben@ip-172-31-2-29 src]$ rpm -e  --nodeps elasticsearch
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)

[ben@ip-172-31-2-29 src]$ sudo rpm -e  --nodeps elasticsearch
[sudo] password for ben: 
Stopping elasticsearch service... OK
warning: /etc/elasticsearch/jvm.options saved as /etc/elasticsearch/jvm.options.rpmsave
warning: /etc/elasticsearch/elasticsearch.yml saved as /etc/elasticsearch/elasticsearch.yml.rpmsave
Deleting log directory... OK

3.常见问题

3.常见问题

3.1 端口问题

如果Elasticsearch启动时候,9200端口已经被占用,Elasticsearch会自动占用9201端口。如果需要指定一个特别端口,只需要把config/elasticsearch.yml中的http.port注释去掉,重新定义一个端口数值即可:

3.2 连接不上elasticsearch

elasticearch 已经安装,正常但是使用9200端口测试没有反应,我们就使用9201试试。

3.3 M2 An exception occurred on ‘sales_model_service_quote_submit_failure’ event: Could not ping search engine: No alive nodes found in your cluster {“exception”:”[objec。。。]

这个原因是 因为M2与elasticsearch没有连接上。

发表回复

要发表评论,您必须先登录。

504 API Bootstrap基础 Composer 基础 Docker elasticsearch facebook Git 基础 Google Go 入门 IntegerNet_Solr jdk Jquery Laravel Laravel-admin Laravel 入门到精通教程 Laravel 基础 Linux Cron Linux sudo linux命令 Linux权限 Linux 用户和组 Linux 解压 Lnmp Magento2 主题 Magento2 事件 Magento2 功能 Magento2 命令 Magento2 安装 Magento2 数据库 Magento2 模块 Mamp Paypal php Phpstorm PHP优化 PHP函数 Php面试题 Robots solr Sourcetree SSH SSL Wordpress 阿里云服务器

  • linux 系统查看所有用户的crontab定时任务2023年1月5日
  • Mgento 2 缓存文件用户组权限不对2023年1月5日
  • Magento 2 中怎么禁用事件观察器2022年12月30日
  • Elasticsearch 安装与卸载2022年12月2日
  • Magento 2.4 Content security policies 内容安全策略2022年11月2日
  • Magento 2.4 Disable Page Builder2022年11月1日
  • phpMyAdmin无法缓存模板文件,所以会运行缓慢2022年10月29日
  • PhpMyAdmin配置文件现在需要一个短语密码2022年10月29日
  • Mamp xxx column name table_namePlease run mysql_upgrade2022年10月29日
  • 如何在 PHPMYADMIN 中将表数据显示设置为最大5002022年10月26日
  • 开源工厂
  • 码农网
  • 前端学习
  • Get社区学习
  • Guru99 学习
  • tecadmin.net
  • 深入理解PHP内核
  • 国际IT专场
  • 51CTO
  • https://bbs.mallol.cn
  • http://techjeffyu.com/
  • https://webkul.com/
  • qastack
  • Innfoq
  • 刘祥博客
  • 阿里云
  • DigitalOcean
  • 华为云服务器
  • 华为云开发者中心
  • 华为云服务器文档
  • 阿里云服务器文档
  • Linux命令大全(手册)
  • WEB技术分享
  • 博学无忧博客
  • Ostechnix
  • Linux公社
  • LinuxHomene
  • Linux 服务器操作
  • Linux 就该这么学
  • Linux 从入门到精通
  • Linux 中国开源社区
  • Linux命令大全(手册)
  • Ubuntu Apache 命令学习
  • CSDN
  • 菜鸟学习教程
  • 鸟哥的Linux 私房菜
  • w3school教程
  • Bootstrap 中文网
  • Yii 中文网
  • Yii中文框架
  • 程序员的在线工具
  • 运维教程
  • 梦康的博客
  • 考评师
  • 社交分享教程
  • GitHub
  • 后端进阶
  • 端隐SDP 零信任安全
  • 示说网
  • 脚本之家
  • 开源资源
  • 蓝文资源库
  • Ubuntu 官网
  • linuxize.com
  • Linux Help
  • tecmint
  • 脚本之家在线工具
  • php1中文社区
  • 云知梦
  • IT之家
  • https://www.geeksforgeeks.org/
  • https://laravel-school.com/
  • https://laravelacademy.org/
  • https://zditect.com/guide/
  • https://www.studytonight.com/
  • https://dev.to/
  • https://dev.to/listings
  • https://dev.to/saifullah/8-free-websites-to-learn-coding-3c5
  • https://www.rakeshjesadiya.com/
  • magento-2-video-tutorials

©2023 小小述博客 | Powered by WordPress and Superb Themes!