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的時候啓動會失敗