Ubuntu deb安装Elasticsearch

释放双眼,带上耳机,听听看~!

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"
}

给TA买糖
共{{data.count}}人
人已赞赏
RabbitMQUbuntu

Ubuntu apt安装RabbitMQ

2022-8-21 17:29:31

Ubuntu报错锦集

apt-get update failed because certificate verification failed because handshake failed on nodesource

2022-9-22 17:36:51

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索