This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
elastic:installation_on_linux [2023/03/08 22:51] – created olaf | elastic:installation_on_linux [2023/03/09 01:05] (current) – olaf | ||
---|---|---|---|
Line 46: | Line 46: | ||
Install vim, tools for importing the elastic key ring, allow apt to download through https and for mounting SMB (CIFS) shares. | Install vim, tools for importing the elastic key ring, allow apt to download through https and for mounting SMB (CIFS) shares. | ||
- | Then get the elastic key ring, add the repository | + | Then get the elastic key ring and add the repository |
<code bash> | <code bash> | ||
apt install -y vim gpg apt-transport-https cifs-utils | apt install -y vim gpg apt-transport-https cifs-utils | ||
wget -qO - https:// | wget -qO - https:// | ||
echo "deb [signed-by=/ | echo "deb [signed-by=/ | ||
+ | </ | ||
+ | |||
+ | Now is a good time to shutdown and clone the VM for the other two nodes.\\ | ||
+ | Remember that the clones will have the name and IP address of the first node. | ||
+ | Therefore, start one after the other and adjust ''/ | ||
+ | |||
+ | Start the first node again, login with ssh, change to root and install elasticsearch: | ||
+ | <code bash> | ||
apt update && apt upgrade -y | apt update && apt upgrade -y | ||
apt install elasticsearch -y | apt install elasticsearch -y | ||
Line 113: | Line 121: | ||
transport.host: | transport.host: | ||
</ | </ | ||
- | Now is a good time to shutdown and clone the VM for the other two nodes.\\ | + | Start the node (deb11-elk-01), |
- | Remember that the clones will have the name and IP address of the first node. | + | |
- | Therefore, start one after the other and adjust ''/ | + | |
- | + | ||
- | Start the first node (deb11-elk-01), | + | |
<code bash> | <code bash> | ||
systemctl daemon-reload | systemctl daemon-reload | ||
Line 179: | Line 183: | ||
The other two nodes have almost all configuration needed. | The other two nodes have almost all configuration needed. | ||
- | Start the second VM (deb11-elk-02) and logon with SSH. | ||
- | |||
+ | On the first node generate a node enrollment token | ||
+ | <code bash> | ||
+ | / | ||
+ | |||
+ | eyJ2ZXIiOiI4LjYuMiIsImFkciI6WyIxMC42OC4xMDAuMTI6OTIwMCJdLCJmZ3IiOiI0MzBhMWRiYWFhZGFmMjEzMjBiYzEyZTI5ZWM5NjhlOTNmZWQzMDA4YzgxMGMwYTY3NjMzOGYyZDY5NjE3OTAxIiwia2V5Ijoibm85cnc0WUIwdkRBWFhaMWpZTnA6MnZLbGs3VElTR09RZDRlS1FQV1NGQSJ9 | ||
+ | </ | ||
+ | |||
+ | Start the second VM (deb11-elk-02), | ||
+ | Add the mount in ''/ | ||
+ | |||
+ | Install elasticsearch: | ||
+ | <code bash> | ||
+ | apt update && apt upgrade -y | ||
+ | apt install elasticsearch -y | ||
+ | </ | ||
+ | |||
+ | Its needed to remove the default configuration: | ||
+ | <code bash> | ||
+ | rm -rf / | ||
+ | rm / | ||
+ | </ | ||
+ | |||
+ | Generate a new / | ||
+ | <code yaml> | ||
+ | # ======================== Elasticsearch Configuration ========================= | ||
+ | # | ||
+ | # NOTE: Elasticsearch comes with reasonable defaults for most settings. | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # 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:// | ||
+ | # | ||
+ | # ---------------------------------- Cluster ----------------------------------- | ||
+ | # | ||
+ | # Use a descriptive name for your cluster: | ||
+ | # | ||
+ | cluster.name: | ||
+ | # | ||
+ | # ------------------------------------ Node ------------------------------------ | ||
+ | # | ||
+ | # Use a descriptive name for the node: | ||
+ | # | ||
+ | #node.name: node-1 | ||
+ | # | ||
+ | # Add custom attributes to the node: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # ----------------------------------- Paths ------------------------------------ | ||
+ | # | ||
+ | # Path to directory where to store the data (separate multiple locations by comma): | ||
+ | # | ||
+ | path.data: / | ||
+ | # | ||
+ | # Path to log files: | ||
+ | # | ||
+ | path.logs: / | ||
+ | # | ||
+ | # Path to snapshot repository | ||
+ | # | ||
+ | path.repo: / | ||
+ | # | ||
+ | # ----------------------------------- Memory ----------------------------------- | ||
+ | # | ||
+ | # Lock the memory on startup: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # 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: | ||
+ | # | ||
+ | network.host: | ||
+ | # | ||
+ | # By default Elasticsearch listens for HTTP traffic on the first free port it | ||
+ | # finds starting at 9200. Set a specific HTTP port here: | ||
+ | # | ||
+ | #http.port: 9200 | ||
+ | # | ||
+ | # For more information, | ||
+ | # | ||
+ | # --------------------------------- Discovery ---------------------------------- | ||
+ | # | ||
+ | # Pass an initial list of hosts to perform discovery when this node is started: | ||
+ | # The default list of hosts is [" | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Bootstrap the cluster using an initial set of master-eligible nodes: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # For more information, | ||
+ | # | ||
+ | # --------------------------------- Readiness ---------------------------------- | ||
+ | # | ||
+ | # Enable an unauthenticated TCP readiness endpoint on localhost | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # ---------------------------------- Various ----------------------------------- | ||
+ | # | ||
+ | # Allow wildcard deletion of indices: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Allow HTTP API connections from anywhere | ||
+ | # Connections are encrypted and require user authentication | ||
+ | http.host: 0.0.0.0 | ||
+ | |||
+ | # Allow other nodes to join the cluster from anywhere | ||
+ | # Connections are encrypted and mutually authenticated | ||
+ | transport.host: | ||
+ | </ | ||
+ | |||
+ | Configure the second node: | ||
+ | <code bash> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Elasticsearch cannot run as root. Therfore it won't start. However, it configures everything and then complaints about being started as root. We just need to adjust a couple of permissions that were set wrong because we tried to start it as root: | ||
+ | |||
+ | <code bash> | ||
+ | chown -R elasticsearch: | ||
+ | chown -R root: | ||
+ | </ | ||
+ | |||
+ | Install ES as service and start it: | ||
+ | <code bash> | ||
+ | systemctl daemon-reload | ||
+ | systemctl enable elasticsearch.service | ||
+ | systemctl start elasticsearch.service | ||
+ | </ | ||
+ | |||
+ | The installation of the third node works like the second - just chage the IP address for network.host in elasticsearch.yml. | ||
+ | |||
+ | Once the cluster is formed (all nodes are running in the same cluster), \\ | ||
+ | adjust discovery.seed_hosts in each nodes elasticsearch.yml: | ||
+ | |||
+ | deb11-elk-01:< | ||
+ | discovery.seed_hosts: | ||
+ | deb11-elk-02:< | ||
+ | discovery.seed_hosts: | ||
+ | deb11-elk-03:< | ||
+ | discovery.seed_hosts: | ||
+ | |||
+ | and on deb11-elk-01 comment-out the line:< | ||
+ | # | ||
+ | |||
+ | Next: **[[elastic: |