💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
<blockquote class="success">注意事项</blockquote> ``` 在线下载可能很慢,安装包可以下载好用ftp上传到指定目录下,本文一律下载在root目录下 ``` ### 一、安装JDK1.8 ``` 1、查看linux 系统环境 getconf LONG_BIT 2、未安装wget请先安装 rpm -qa|grep "wget" yum -y install wget 3、下载JDK安装包 wget --no-check-certificate http://www.ryloo.icu/jdk-8u251-linux-x64.tar.gz 4、创建安装目录 mkdir /usr/local/java/ 5、解压至安装目录 tar -zxvf jdk-8u251-linux-x64.tar.gz -C /usr/local/java/ 6、设置环境变量 vim /etc/profile 在末尾添加 export JAVA_HOME=/usr/local/java/jdk1.8.0_251 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH 7、使环境变量生效 source /etc/profile 8、添加软链接 ln -s /usr/local/java/jdk1.8.0_251/bin/java /usr/bin/java 9、检查 java -version ``` ### 二、安装elasticsearch-7.6.2 ``` 1、下载elasticsearch安装包 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz 2、创建安装目录 mkdir /usr/local/es/ 3、解压至安装目录 tar -zxvf elasticsearch-7.6.2-linux-x86_64.tar.gz -C /usr/local/es/ 4、修改配置,内存占用可以调小一点 vim /usr/local/es/elasticsearch-7.6.2/config/jvm.options ``` ![](http://cloud.ryloo.icu/e5880fb9259f7c28d1c9f73604e6f0c0) ``` 5、配置elasticsearch.yml vim /usr/local/es/elasticsearch-7.6.2/config/elasticsearch.yml ``` ![](http://cloud.ryloo.icu/825ee90c7569aaa4dc506b5f62584676) ![](http://cloud.ryloo.icu/357edfe940082ef156b288e06a7da9e9) ### 三、创建账户esuser,因为es默认不允许以root账户运行 ``` //创建用户组 groupadd esgroup //创建用户 useradd -g esgroup esuser //设置权限 chown -R esuser:esgroup /usr/local/es/ //设置密码 864923705 passwd esuser ``` ### 四、修改linux内核参数 ``` //修改/etc/security/limits.conf 增加下面内容 * soft nproc 65535 * hard nproc 65535 * soft nofile 65535 * hard nofile 131072 //修改/etc/sysctl.conf 增加下面内容 vm.max_map_count=655360 //然后执行命令,使配置生效** sysctl -p ``` ### 五、启动 ``` //切换用户 su esuser //切换目录 cd /usr/local/es/elasticsearch-7.6.2/bin //前台启动es,Ctrl + C 则程序终止 ./elasticsearch //后台启动es ./elasticsearch -d //查找es进程 ps -ef | grep elastic //杀掉ES进程 kill -9 xxxx ``` ### 六、访问 ``` //测试 curl 127.0.0.1:9200 | curl IP:9200 //curl: (7) couldn't connect to host iptables -I INPUT 1 -p tcp --dport 9200 -j ACCEPT ``` ![](http://cloud.ryloo.icu/232a500c143b009e690fddbcdbd49e40) ### 七、配置文件参数详解 [【elasticsearch.yml】](https://www.cnblogs.com/hanyouchun/p/5163183.html) ### 八、账号密码设置 1、elasticsearch.yml 设置 ~~~ http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-headers: Authorization,X-Requested-With,Content-Type,Content-Length xpack.security.enabled: true xpack.security.transport.ssl.enabled: true ~~~ 设置密码 ~~~ [root@VM-0-11-centos bin]# su esuser [esuser@VM-0-11-centos bin]# whereis gcc gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz [esuser@VM-0-11-centos bin]$ cd ~ [esuser@VM-0-11-centos ~]$ cd /usr/bin [esuser@VM-0-11-centos bin]$ /usr/local/es/elasticsearch-7.6.2/bin/elasticsearch-setup-passwords interactive ~~~ ![](http://cloud.ryloo.icu/ce743822c63f489ea83a7dc5b1a2023a) 重启服务 ![](http://cloud.ryloo.icu/9c1c8dddae0246566f67735b23db2e7e) 2、elasticsearch-head ES开启安全密码认证后,在web界面访问时,该框由原来的 http://118.25.242.51:9100替换为 http://118.25.242.51:9100/?auth\_user=elastic&auth_password=你的es密码,例如: ![](http://cloud.ryloo.icu/5f4fa80103eed9e4475c7726d25975e3) 3、Kibana > vi /usr/local/kibana/kibana-7.6.2-linux-x86_64/config/kibana.yml ![](http://cloud.ryloo.icu/8e1a7481cd1a5506839bd9cf7750ba26) ![](http://cloud.ryloo.icu/a4788a3c8938ae78f4a33699c62f4ad4) 4、logstash >需修改导入数据的配置文件,例: ~~~ output { elasticsearch { hosts => ["118.25.242.51:9200"] user => "elastic" password => "123456" index => "lawsuit_clauses_v1" document_id => "%{id}" } # 这里输出调试,正式运行时可以注释掉 stdout { codec => json_lines } } ~~~ ![](http://cloud.ryloo.icu/ef6db89b7713f1e720d7b7ddba1fed4d) ### 九、ES开机启动 参考博主文章 # [elasticsearch设置开机自启动](https://www.cnblogs.com/tester-yu/p/14889003.html) ~~~ // 先查看当前的开机启动服务 chkconfig --list // 创建es 的系统启动服务文件,进入到 cd /etc/init.d 目录 cd /etc/init.d   vi elasticsearch // 复制以下脚本 #!/bin/bash #chkconfig: 345 63 37 #description: elasticsearch #processname: elasticsearch-7.6.2 export ES_HOME=/usr/local/es/elasticsearch-7.6.2 case $1 in start) su esuser<<! cd $ES_HOME ./bin/elasticsearch -d -p pid exit ! echo "elasticsearch is started" ;; stop) pid=`cat $ES_HOME/pid` kill -9 $pid echo "elasticsearch is stopped" ;; restart) pid=`cat $ES_HOME/pid` kill -9 $pid echo "elasticsearch is stopped" sleep 1 su esuser<<! cd $ES_HOME ./bin/elasticsearch -d -p pid exit ! echo "elasticsearch is started" ;; *) echo "start|stop|restart" ;; esac exit 0 // 修改文件权限 chmod 777 elasticsearch // 添加服务并设置启动方式 chkconfig --add elasticsearch chkconfig elasticsearch on // 重启后,验证是否已启动 ps -ef | grep elasticsearch ~~~ ![](http://cloud.ryloo.icu/b19138b566c313d49d3da2b6bfacb857) ![](http://cloud.ryloo.icu/544bb89526faa4c577e52d4bab0a5dde) ![](http://cloud.ryloo.icu/9db9444995fca933601e15cc3c7ca166) ![](http://cloud.ryloo.icu/08eb81a894e2b2413fb9a76550b0f2bb) 重启,等服务器启动elasticsearch服务。 ![](http://cloud.ryloo.icu/dd86855a794df287927b744ab221e707)