elasticsearch安装使用

1、下载页面

https://www.elastic.co/downloads/past-releases#elasticsearch

在该页面下找到需要的版本进行下载。

2、安装

将下载文件上传服务器。

解压文件

运行bin/elasticsearch -d(或bin\elasticsearch.bat在Windows上)

运行curl http://localhost:9200/Invoke-RestMethod http://localhost:9200使用PowerShell

配置文件修改
修改elasticSeach.yml配置文件即可
        
    //在conf
            # 修改集群名字(名字随便起,没有什么意义)
            cluster.name: my-cluster
            
            # 如果是单节点(名字随便起,如果是集群则不能重复)
            node.name: node-1
            
            # ES所存放数据的位置(默认data目录不存在,需要自己手动创建  mkdir data   cd data  pwd 获得路径!)
            path.data: /home/apps/elasticsearch-6.4.0/data
            
            # ES的日志存放目录(默认已经存在,直接使用即可,不需要创建)
            path.logs: /home/apps/elasticsearch-6.4.0/logs
            
            # 放开ES的内存锁,让ES直接拥有最大内存使用权
            bootstrap.memory_lock: false
            
            # centos6中没有CONFIG_SECCOMP_FILTER,但是centos7中有,如果linux系统为centos6则需要关闭过滤
            bootstrap.system_call_filter: false
            
            # ES的主机地址(一旦配置的是0,就是代表所有的电脑都可以连接(对连接不再造成任何限制))
            network.host: 192.168.0.14(0.0.0.0)
            
            # ES的默认端口号(./elasticsearch -d(启动的是ES的控制台))
            http.port: 9200
            
            # 识别其他的集群host(如果为单节点只需要写一个)
            discovery.zen.ping.unicast.hosts: ["192.168.0.14"]
            
            多个的写法。。。
            discovery.zen.ping.unicast.hosts: ["192.168.0.14","",""]

3、设置密码

版本为7.X

1、进入es安装目录下的config目录
vim elasticsearch.yml
配置X-Pack
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
2、重启elasticsearch服务
3、执行设置用户名和密码的命令,需要为4个用户分别设置密码:elastic、kibana、logstash_system、beats_system
进入bin目录
cd /usr/local/elasticsearch-7.2.0/bin
执行命令
./elasticsearch-setup-passwords interactive

[was@csydywzc-006 config]$ ../bin/elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y


Enter password for [elastic]: 
Reenter password for [elastic]: 
Enter password for [apm_system]: 
Reenter password for [apm_system]: 
Enter password for [kibana]: 
Reenter password for [kibana]: 
Enter password for [logstash_system]: 
Reenter password for [logstash_system]: 
Enter password for [beats_system]: 
Reenter password for [beats_system]: 
Enter password for [remote_monitoring_user]: 
Reenter password for [remote_monitoring_user]: 
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]

4、修改密码命令:
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://127.0.0.1:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'

4、系统默认的参数不够,需要修改参数:

用户对软件的内存和硬盘使用权限
vim /etc/security/limits.conf
* soft nproc 655350
* soft nofile 655350
* hard nproc 655350
* hard nofile 655350

修改最大线程数
vim /etc/sysctl.conf
vm.max_map_count=262144

配置用户最大的线程数
vim /etc/security/limits.d/20-nproc.conf
*          soft    nproc     4096


使修改永久生效
sysctl -p

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值