spring/springboot集成spring-data-elasticsearch 3.1.6。从安装到集成附spring-boot源码

    ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。

一. ElasticSearch6.2.2下载安装步骤

说明:ElasticSearch的运行不能用root执行,自己用useradd命令新建一个用户如下所示:
sueradd test
chown -R test  /user/local/elasticsearch6.2.2
   此处给新增的用户授权
下载地址:https://www.elastic.co/downloads/elasticsearch 下载最新的安装包并解压、然后执行、命令如下:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz
 
tar -zxvf elasticsearch-6.2.2
cd elasticsearch-6.2.2
./bin/elasticsearch

执行之前就得修改配置文件:

vim config/elasticsearch.yml
vim config/elasticsearch.yml 

修改方法参考如下:

    cluster.name: elk_test.cluster
    node.name: node-01
    node.master: true
    node.data: true
    network.host: 0.0.0.0
    http.port: 9200
    discovery.zen.ping.unicast.hosts: ["192.168.0.153","192.168.0.154","192.168.0.155"]
    #discovery.zen.ping.multicast.enabled: true
    discovery.zen.minimum_master_nodes: 2
    http.cors.enabled: true
    http.cors.allow-origin: "*"

    

(1)cluster.name
如果要配置集群需要两个节点上的elasticsearch配置的cluster.name相同,都启动可以自动组成集群,这里如果不改cluster.name则默认是cluster.name=my-application,
(2)nodename随意取但是集群内的各节点不能相同
(3)修改后的每行前面不能有空格,修改后的“:”后面必须有一个空格
解释说明:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false 一看就知道是关于内用访问的方面的配置
cluster.name 集群名字,同一个集群中使用相同名字,单机就随意
node.name: node-01 节点名字
node.master: 是否为集群的master机器
node.data: true 是否作为数据节点
network.host: 192.168.0.153 这个不用自然是配置ip地址的
http.port: 9200 端口号,不配置的话默认9200
discovery.zen.ping.unicast.hosts: [“192.168.0.153”,”192.168.0.154”,”192.168.0.155”] 这个就是配置集群的时候要用的到了,[]中填上集群中其他集群的ip的地址,如果是master的话请把所有salve的机器地址填上
discovery.zen.minimum_master_nodes: 2 关于这个值配置多少合适的话大家去搜一下,自己权衡一下集群,这里我用了3台机器模拟集群,所以填上2。
http.cors.enabled: true 这个参数的设置和下面一个配置就关于ip的访问策略了,如果你发现其他ip地址访问不了就有可以这参数没有配置
http.cors.allow-origin: “*”
如果你碰到错误不要慌下面有解决方法:
[1]"max file descriptor
[2]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决方法,请用root权限修改,修改完记得重启elasticsearch和使用配置参数在环境里面生效(重新登录用户):(如果还有错误请把数字再设置大一点)
vi /etc/security/limits.conf 
 
*  soft  nofile  65536
 
*  hard  nofile  131072
 
*  soft  nproc  2048
 
*  hard  nproc 4096
2、max number of threads
max number of threads [1024] for user [user] is too low, increase to at least [2048]
解决方法: (* 表示对所有用户有效)
vi /etc/security/limits.d/90-nproc.conf 
#修改内容如下
*  soft  nproc  1024
3、在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstr

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值