elasticsearch 安装,新版本已经不支持jdk1.8,使用下载elasticsearch压缩包里面自带的jdk即可。
单台elasticsearch 启动前配置
打开config/elasticsearch.yml配置
node.name 名称和 cluster.initial_master_nodes: [node.name],需要一致,不然启动会报找不到,使用client也会连不上
network.host: 0.0.0.0 是所有IP可以访问,启动会获取当前IP,开发可以这样设置,生产还是需要配置IP的
http.port: 9200 是打开HTTP请求端口,通过客户端可以通过http://ip:9200访问,9300是tcp端口不是http端口
出现错误提示
[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
添加 cluster.initial_master_nodes: [node.name]
设置默认值 discovery.seed_hosts: ["127.0.0.1", "[::1]"]
跨域设置
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.memory_lock: false 锁定物理内存优化配置,true的话就是锁定物理内存,防止内存被交换出去
bootstrap.system_call_filter: false 部分版本true的时候启动会失败