介绍
蝉鸣CRM 是一个全新的软件开发框架。
说明
Debain12默认仓库不包含Elasticsearch
更新APT源Elasticsearch 官方APT 仓库
- 更新源
bash
sudo apt update -y- 安装 HTTPS 支持
bash
sudo apt-get install apt-transport-https- 导入 Elasticsearch GPG 密钥
bash
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg- 添加 Elasticsearch APT 源
bash
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/9.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-9.x.list- 更新软件包列表
bash
sudo apt update -y安装Elasticsearch
- 安装elasticsearch
bash
sudo apt install elasticsearch- 验证安装
bash
curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200- 启动失败错误日志
bash
sudo journalctl -u elasticsearch --no-pager -n 50- 查看密码
bash
sudo grep "Password" /var/log/elasticsearch/elasticsearch.log- 重置密码
bash
sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic- 安装分词器
bash
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu- 验证插件安装
bash
sudo ls /usr/share/elasticsearch/plugins- 编辑配置文件
bash
vim /etc/elasticsearch/elasticsearch.ymlbash
# elasticsearch 启动默认增加一下配置
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 21-04-2025 03:18:56
#
# --------------------------------------------------------------------------------
# Enable security features
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: true
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["DESKTOP-6551FGP"]
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------
#默认开启安全校验,如需关闭修改一下配置
# 禁用安全功能(关闭密码和 TLS)
xpack.security.enabled: false
# 如果需要关闭 HTTPS(可选)
xpack.security.http.ssl:
enabled: falsebash
vim /etc/elasticsearch/jvm.optionsbash
# elasticsearch 启动默认占用服务器一半内存,需要根据需要调整
-Xms2g
-Xmx2g卸载Elasticsearch
- 停止Elasticsearch服务
bash
sudo systemctl stop elasticsearch- 卸载Elasticsearch相关包
bash
sudo apt purge -y elasticsearch
sudo apt autoremove -y- 删除残留数据和配置文件
bash
sudo rm -rf /var/lib/elasticsearch/
sudo rm -rf /etc/elasticsearch/- 清理APT仓库
bash
sudo rm /etc/apt/sources.list.d/elastic-9.x.list
sudo apt update常用命令
bash
#启动 Elasticsearch
sudo systemctl start elasticsearch
#停止 Elasticsearch
sudo systemctl stop elasticsearch
#重启 Elasticsearch
sudo systemctl restart elasticsearch
#查看 Elasticsearch 状态
sudo systemctl status elasticsearch
#开机 Elasticsearch 自启
sudo systemctl enable elasticsearch
#验证 Elasticsearch
curl -X GET "localhost:9200"