当前位置 博文首页 > json_li的博客:Linux安装jdk及ElasticSearch

    json_li的博客:Linux安装jdk及ElasticSearch

    作者:[db:作者] 时间:2021-08-25 15:52

    安装java环境

    yum install java-1.8.0-openjdk* -y

    查看安装情况

    java -version

    ?

    1.运行环境

    a.JDK8+ ?

    b.系统可用内存>2G

    2.下载

    git clone git://github.com/medcl/elasticsearch-rtf.git -b master --depth 1
    
    cd elasticsearch-rtf/bin
    
    ./elasticsearch

    不能用root用户运行 ?创建一个新用户试试

    adduser es
    
    passwd es

    改一下es目录所属用户:

    chown -R es ./elasticsearch-rtf/

    vim 编辑 /etc/security/limits.conf,在末尾加上:

    es soft nofile 65536
    
    es hard nofile 65536
    
    es soft nproc 4096
    
    es hard nproc 4096

    vim 编辑 vim /etc/security/limits.d/20-nproc.conf,将* 改为用户名(es):

    # Default limit for number of user's processes to prevent
    
    # accidental fork bombs.
    
    # See rhbz #432903 for reasoning.
    
    
    es          soft    nproc     4096
    
    root       soft    nproc     unlimited

    vim 编辑 /etc/sysctl.conf,在末尾加上:

    vm.max_map_count = 655360

    执行:

    [root@localhost ~]# sysctl -p
    

    登录刚才新建的es用户,并启动elasticsearch,OK

    [root@localhost elasticsearch-rtf]# su es
    
    [es@localhost elasticsearch-rtf]$ ./bin/elasticsearch

    本地能够访问到

    但是外部浏览器无法访问

    编辑

    vim /elasticsearch-rtf/config/elasticsearch.yml

    关闭服务,重新运行

    可以访问了

    后台运行:

    ./bin/elasticsearch -d

    查看进程:

    ps -ef|grep elasticsearch

    关闭,直接杀死进程

    ?

    cs