Ubuntu deb安装Elasticsearch

2023年 5月 4日 27.3k 0

es启动需要有jdk环境,我们需要安装jdk环境

#下载jdk
wget https://d.frps.cn/file/tools/jdk/jdk-8u231-linux-x64.tar.gz

配置JDK环境

mkdir /usr/java
tar zxvf jdk-8u231-linux-x64.tar.gz -C /usr/java
ln -s /usr/java/jdk1.8.0_231/ /usr/java/jdk

#配置环境变量
cat > /etc/profile << EOF
# set java environment  
export JAVA_HOME=/usr/java/jdk
export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar:\$JAVA_HOME/jre/lib/rt.jar
export PATH=\$PATH:\$JAVA_HOME/bin
EOF
source /etc/profile

检查jdk环境

root@iZ2zeipez8ut08dv6ypru0Z:~# java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

es安装
首先需要下载es7

#官方下载地址:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-amd64.deb

#abcdocker下载地址
wget https://d.frps.cn/file/tools/es/elasticsearch-7.15.0-amd64.deb

安装deb文件

dpkg -i elasticsearch-7.15.0-amd64.deb

备份原来文件

mv /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml_bak_2022-08-21

设置配置文件

cat > /etc/elasticsearch/elasticsearch.yml << EOF
cluster.name: my-es
node.name: node-1
network.host: 0.0.0.0
indices.query.bool.max_clause_count: 1024000
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"
cluster.initial_master_nodes: ["node-1"]
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
EOF

创建数据存储目录

mkdir /data/elasticsearch/{data,logs} -p

授权(我这里直接授权777了,可以授权启动用户,使用普通用户启动)

chmod -R 777 /data/elasticsearch/

es 还需要修改limit

cat >> /etc/security/limits.conf << KFC
    *   softnofile  65536
    *   hardnofile  65536
    *   softnproc   65536
    *   hardnproc   65536
KFC

echo 'ulimit -SHn 65536' >>/etc/profile
echo 'vm.max_map_count=655360' >>/etc/sysctl.conf
source /etc/profile && sysctl -p

启动es

/etc/init.d/elasticsearch start

检查9200是否正常

root@iZ2zeipez8ut08dv6ypru0Z:~# curl localhost:9200
{
  "name" : "node-1",
  "cluster_name" : "my-es",
  "cluster_uuid" : "NpY5vHfbR0CnRF9EHLYodw",
  "version" : {
    "number" : "7.15.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "79d65f6e357953a5b3cbcc5e2c7c21073d89aa29",
    "build_date" : "2021-09-16T03:05:29.143308416Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

相关文章:

  1. ELKStack 实战之 Elasticsearch [一]
  2. ELKStack 实战之 Elasticsearch集群 [二]
  3. ELK 二进制安装并收集nginx日志
  4. Ubuntu 二进制安装mysql 5.7

相关文章

KubeSphere 部署向量数据库 Milvus 实战指南
探索 Kubernetes 持久化存储之 Longhorn 初窥门径
征服 Docker 镜像访问限制!KubeSphere v3.4.1 成功部署全攻略
那些年在 Terraform 上吃到的糖和踩过的坑
无需 Kubernetes 测试 Kubernetes 网络实现
Kubernetes v1.31 中的移除和主要变更

发布评论