Can I install ELastic Search twice as a windows service?

For reasons that may be uninteresting to many, I find myself needing to run two instances of ElasticSearch on the same Windows machine. I have unzipped the 7.13.4 archive into two separate directories and set them up and they run just fine as BAT files. However, when I install them as Windows services using NSSM (with unique names), they install but once I run the second one the first one pauses, then the second one pauses.
I am not a Windows guy, so the service thing is not completely understood. Any threads I can pull to figure out why they won't both run?

Thanks!

What is the configuration of each one of your instance? Share the elasticsearch.yml of each one.

Also, what do you have in the logs when you start and when the instance stops?

Could you share why you need this? How much RAM do you have on your machine?

It is a legacy installation setup. The machine has 32G of ram on a XEON processor. The reason is they want an ILM policy for Hot / Warm. The Hot node is installed on the C drive (SDD) and the Warm node is installed on the D drive (spinning disk) I have explained the idea of hot/warm is not as dependent on the type of drive it is installed on, but that it is sharing the OS and processors. I suggested they run a single instance and they will get better performance but they are having none of that. So, I need to run two instances.

My bad. 2.1 GHz Xeon, but only 16 GB Ram and it running Windows Server 2016 (64bit)

You can run multiple instances on the same server, but you need to have completely separated configurations and services, you need to share your configurations.

Anyway, with 16 GB you could use 8 GB for your instances each one with 4 GB, but I would not recommend that, and neither using a hot/warm architecture in this configuration, the performance will be better using a single instance with 8 GB of HEAP.

1 Like

Hot Node

# -----------------------------------------------------------
#
cluster.name: my-cluster
node.name: node-hot
path.data: /ELK/data-hot
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300
cluster.initial_master_nodes: ["node-hot"]
node.roles: [master, data, ingest, remote_cluster_client]
node.attr.data: "hot"

## License
xpack.license.self_generated.type: basic

# Security
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12

Warm Node

# -----------------------------------------------------------
cluster.name: my-cluster
node.name: node-warm
path.data: /ELK/data-warm
network.host: 0.0.0.0
http.port: 9201
cluster.initial_master_nodes: ["node-hot"]
node.roles: [data]
node.attr.data: "warm"

## License
xpack.license.self_generated.type: basic

# Security
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12

When I run ES as a BAT file, I get the various logs in the 'log' directory. Once I start ES as a Windows Service, I no longer see the logs in the 'log' directory. Are they being written somewhere else?

I would recommend that you follow this part of the documentation and use the mentioned .bat. file to create your services and see if it works.

Also, you need to set everything in your elasticsearch.yml file, you are not setting the path.logs and your warm not are not setting the transport.tcp port, in this scenario if for some reason the warm node starts first it will try to bind to the port 9300 and your hot node will not be able to start as it will also try to bind to the same port.

You are also missing the discovery.seed_hosts config.

The first part of your hot node configuration should look like this:

cluster.name: my-cluster
node.name: node-hot
path.data: /path/to/hot-data
path.logs: /path/to/hot-logs
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300
cluster.initial_master_nodes: ["node-hot"]
discovery.seed_hosts: ["hostname-of-your-node:9300"]
node.roles: [master, data, ingest, remote_cluster_client]
node.attr.data: "hot" 

And your warm node should have a configuration like this:

cluster.name: my-cluster
node.name: node-warm
path.data: /path/to/warm-data
path.logs: /path/to/warm-logs
network.host: 0.0.0.0
http.port: 9201
transport.port: 9301
cluster.initial_master_nodes: ["node-hot"]
discovery.seed_hosts: ["hostname-of-your-node:9300"]
node.roles: [data]
node.attr.data: "warm" 

You also have limited resources, you should configure the jvm.options of each node and set the Xms and Xmx options to no more than 4 GB for each node.

I rarely use windows, but the above configuration should help to isolate the nodes datas and logs.

Nice! Will give that a try today. As for the discovery.seed_hosts value, though. Since these are both running on the same machine with one ip address, is the 'hostname-of-your-node' just 'localhost' or the ip address of the machine?

As a follow up, I was able to install ElasticSearch twice as a windows service. I did need to use the supplied scripts instead of NSSM. I’m sure NSSM can do it, but would need more configuration like environment variables to make it work. Thanks for all the help,

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.