]$ vi /opt/elasticsearch-8.10/config/elasticsearch.yml # ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please consult the documentation for further information on configuration options: # https://www.elastic.co/guide/en/elasticsearch/reference/index.html # # ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # cluster.name: es-cluster # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # node.name: node-01 # node.roles: [ master, data ] # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # path.data: /opt/elasticsearch-8.10/data # # Path to log files: # path.logs: /opt/elasticsearch-8.10/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #bootstrap.memory_lock: true # # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # By default Elasticsearch is only accessible on localhost. Set a different # address here to expose this node on the network: # # 允许连接IP network.host: 0.0.0.0 # # By default Elasticsearch listens for HTTP traffic on the first free port it # finds starting at 9200. Set a specific HTTP port here: # # 网页访问端口,自定义设置为9201 http.port: 9201 # http.cors.enabled: true # http.cors.allow-origin: "*" # # 集群内部通信端口,自定义为设置9301 transport.port: 9301 # For more information, consult the network module documentation. # # xpack xpack.security.enabled: true xpack.security.transport.ssl.enabled: true xpack.security.transport.ssl.verification_mode: none xpack.security.transport.ssl.keystore.path: /opt/elasticsearch-8.10/config/certs/elastic-certificates.p12 xpack.security.transport.ssl.truststore.path: /opt/elasticsearch-8.10/config/certselastic-certificates.p12 ingest.geoip.downloader.enabled: false # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when this node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # discovery.seed_hosts: ["10.10.0.106:9301", "10.10.0.107:9301", "10.10.0.108:9301"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # cluster.initial_master_nodes: ["node-01", "node-02", "node-03"] # # For more information, consult the discovery and cluster formation module documentation. # # ---------------------------------- Various ----------------------------------- # # Allow wildcard deletion of indices: # #action.destructive_requires_name: false
># 进入到/opt/elasticsearch-8.10目录 >]$ cd /opt/elasticsearch-8.10
># 前台启动elasticsearch服务,可以使用Ctrl + Z中断进程 >]$ bin/elasticsearch ># elasticsearch服务启动后输出账号信息和token >━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ >✅ Elasticsearch security features have been automatically configured! >✅ Authentication is enabled and cluster connections are encrypted.
>ℹ️ Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`): qWftAXx1HeHtIE=d5We2
>ℹ️ HTTP CA certificate SHA-256 fingerprint: f1b884c1e1f04f34c9590a2934a33cb47053ef778ca370e003e3dab2ee3dd8ac
>ℹ️ Configure Kibana to use this cluster: >• Run Kibana and click the configuration linkin the terminal when Kibana starts. >• Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes): eyJ2ZXIiOiI4LjEwLjIiLCJhZHIiOlsiMTAuMTAuMC4xMDA6OTIwMCJdLCJmZ3IiOiJmMWI4ODRjMWUxZjA0ZjM0Yzk1OTBhMjkzNGEzM2NiNDcwNTNlZjc3OGNhMzcwZTAwM2UzZGFiMmVlM2RkOGFjIiwia2V5IjoibXZod3pZb0JQUmVQV21aMFFEMWg6dHNpM3RfcHRSWmlJT3JvT2RXZktNUSJ9
>ℹ️ Configure other nodes to join this cluster: >• On this node: ⁃ Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`. ⁃ Uncomment the transport.host setting at the end of config/elasticsearch.yml. ⁃ Restart Elasticsearch. >• On other nodes: ⁃ Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated. >━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5.2 修改elastic密码
如果集群搭建成功只需要在一个节点上更改即可。
-i:设置自定义密码
1 2 3 4 5 6 7 8 9
]$ bin/elasticsearch-reset-password -u elastic -i This tool will reset the password of the [elastic] user. You will be prompted to enter the password. Please confirm that you would like to continue [y/N]y
Enter password for [elastic]: Re-enter password for [elastic]: Password for the [elastic] user successfully reset.
]$ bin/elasticsearch-reset-password -u elasti This tool will reset the password of the [elastic] user to an autogenerated value. The password will be printed in the console. Please confirm that you would like to continue [y/N]y
Password for the [elastic] user successfully reset. New value: gvrAgckR9fmxqDjgX*Iy
# 列出所有索引 ]$ curl -k --user elastic:admin@123 -XGET http://10.10.0.106:9201/_cat/indices?v health status index uuid pri rep docs.count docs.deleted store.size pri.store.size green open .infini_index DsgysdAhQkWFh2mGuuTrjg 1 1 0 0 496b 248b green open .infini_rbac-role yFpRSjMdSvCmV2DNfDfsLQ 1 1 0 0 496b 248b green open .infini_flow mkxo8c22QCmq5lkIptrzLw 1 1 0 0 496b 248b green open .infini_agent-setting L3vfs9-pRTGO4EytGOSjPA 1 1 0 0 496b 248b green open .infini_notification fXgzijXNTNeV9C0xFTud6Q 1 1 0 0 496b 248b green open .infini_alert-history-00001 A_a1r7tUTMSEk1qZzS1_hg 1 1 1908 0 4.8mb 2.2mb green open .infini_layout LFdNGL9KTei79ELFUNsFFw 1 1 6 0 99.5kb 49.7kb green open .infini_agent rYV77XEWRMCJgZ28BndAag 1 1 0 0 496b 248b green open .infini_host RE6O9AUPSkW14UVDl4laRg 1 1 0 0 496b 248b green open .infini_channel L2rmNSaeSQi6BNna8jUXvA 1 1 12 0 59.1kb 29.5kb green open .infini_view KpveoSIlQOiQaTX8-AoPCA 1 1 1 0 39.2kb 19.6kb green open .infini_cluster H9blKu6xS_mJR7k-CPThAQ 1 1 2 0 77.9kb 38.9kb green open .infini_credential mdWpiBn7Q6C_Ygg33cDLeA 1 1 2 0 28.7kb 14.3kb green open .infini_entry -d2FhGB5R5e5qWHuyNpjAg 1 1 0 0 496b 248b green open .infini_instance 26UNDHReTCiWd9kd09QDGQ 1 1 0 0 496b 248b green open .infini_email-server gC2aArmzSjquVDDwsz1HYg 1 1 0 0 496b 248b green open .infini_logs-00001 qtemoj7gT8mxG5smEhWbvg 1 1 0 0 496b 248b green open .infini_activities-00001 IVyv7IVrSxGaWte_uZ7D0A 1 1 10 0 199.2kb 99.6kb green open .infini_async_bulk_results-00001 rBb9o5j-T96nauWTc8FL-g 1 1 0 0 496b 248b green open .infini_metrics-00001 brjM66k5TxG2a1pyzXfJfw 1 1 0 0 496b 248b green open .infini_alert-rule KT0qvEuJS12oxHA4F0VaEQ 1 1 9 0 136.3kb 84.3kb green open .infini_rbac-user xq6xQaO7T4SnbK418HoJBQ 1 1 1 0 17.2kb 8.6kb green open .infini_requests_logging-00001 fIjXHsqKQZ-e9Tl8HlydpQ 1 1 0 0 496b 248b green open .infini_router vJmjqkFlT8-Dw9m6g3hoFg 1 1 0 0 496b 248b green open .infini_agent-node CPJP7Bf4TyCp2JT-ZgCwEA 1 1 0 0 496b 248b green open .infini_visualization W23ch_uVSnCkUGj7fEonWg 1 1 0 0 496b 248b green open .infini_commands GVXDtUtvTluy638nKmNS7Q 1 1 0 0 496b 248b green open .infini_task Ds0D3heBSeet_qji3Z1L3Q 1 1 0 0 496b 248b green open .infini_widget aEbh3NE8QgGUR1NqtQollA 1 1 8 0 58.4kb 29.2kb green open .infini_node TaFVUb5rQQGaUsoxPFlB2A 1 1 5 1 175.1kb 86.9kb green open .infini_alert-message 53P1bRafQ5e4qeCN0XOKmg 1 1 0 0 496b 248b green open .infini_dashboard Yott5pYoQIy73d3ROkY3zQ 1 1 0 0 496b 248b
# 列出所有索引 ]$ curl -k --user elastic:admin@123 -XGET "http://10.10.0.106:9201/_cat/indices?v" health status index uuid pri rep docs.count docs.deleted store.size pri.store.size green open .infini_instance 26UNDHReTCiWd9kd09QDGQ 1 1 0 0 496b 248b green open .infini_channel L2rmNSaeSQi6BNna8jUXvA 1 1 12 0 59.1kb 29.5kb green open .infini_rbac-role yFpRSjMdSvCmV2DNfDfsLQ 1 1 0 0 496b 248b green open .infini_index DsgysdAhQkWFh2mGuuTrjg 1 1 0 0 496b 248b green open .infini_agent-setting L3vfs9-pRTGO4EytGOSjPA 1 1 0 0 496b 248b green open .infini_email-server gC2aArmzSjquVDDwsz1HYg 1 1 0 0 496b 248b green open .infini_view KpveoSIlQOiQaTX8-AoPCA 1 1 1 0 39.2kb 19.6kb green open .infini_commands GVXDtUtvTluy638nKmNS7Q 1 1 0 0 496b 248b green open .infini_alert-message 53P1bRafQ5e4qeCN0XOKmg 1 1 0 0 496b 248b green open .infini_router vJmjqkFlT8-Dw9m6g3hoFg 1 1 0 0 496b 248b green open .infini_widget aEbh3NE8QgGUR1NqtQollA 1 1 8 0 58.4kb 29.2kb green open .infini_alert-rule KT0qvEuJS12oxHA4F0VaEQ 1 1 9 0 136.3kb 84.3kb green open .infini_credential mdWpiBn7Q6C_Ygg33cDLeA 1 1 2 0 28.7kb 14.3kb green open .infini_metrics-00001 brjM66k5TxG2a1pyzXfJfw 1 1 0 0 496b 248b green open .infini_host RE6O9AUPSkW14UVDl4laRg 1 1 0 0 496b 248b green open .infini_layout LFdNGL9KTei79ELFUNsFFw 1 1 6 0 99.5kb 49.7kb green open .infini_node TaFVUb5rQQGaUsoxPFlB2A 1 1 5 1 175.1kb 86.9kb green open .infini_dashboard Yott5pYoQIy73d3ROkY3zQ 1 1 0 0 496b 248b green open .infini_alert-history-00001 A_a1r7tUTMSEk1qZzS1_hg 1 1 1953 0 5.3mb 2.2mb green open .infini_agent-node CPJP7Bf4TyCp2JT-ZgCwEA 1 1 0 0 496b 248b green open .infini_visualization W23ch_uVSnCkUGj7fEonWg 1 1 0 0 496b 248b green open .infini_requests_logging-00001 fIjXHsqKQZ-e9Tl8HlydpQ 1 1 0 0 496b 248b green open .infini_activities-00001 IVyv7IVrSxGaWte_uZ7D0A 1 1 10 0 199.2kb 99.6kb green open .infini_rbac-user xq6xQaO7T4SnbK418HoJBQ 1 1 1 0 17.2kb 8.6kb green open .infini_cluster H9blKu6xS_mJR7k-CPThAQ 1 1 2 0 77.9kb 38.9kb green open .infini_flow mkxo8c22QCmq5lkIptrzLw 1 1 0 0 496b 248b green open customertxt SFRMTwr4Tfukxlt_TY41pg 1 1 0 0 452b 226b green open .infini_logs-00001 qtemoj7gT8mxG5smEhWbvg 1 1 0 0 496b 248b green open .infini_notification fXgzijXNTNeV9C0xFTud6Q 1 1 0 0 496b 248b green open .infini_async_bulk_results-00001 rBb9o5j-T96nauWTc8FL-g 1 1 0 0 496b 248b green open .infini_agent rYV77XEWRMCJgZ28BndAag 1 1 0 0 496b 248b green open .infini_entry -d2FhGB5R5e5qWHuyNpjAg 1 1 0 0 496b 248b green open .infini_task Ds0D3heBSeet_qji3Z1L3Q 1 1 0 0 496b 248b