I am trying to start elasticsearch as a process and stop it without closing the command prompt. For creating a new process, I am using:
C:\Users\User1\Desktop\Work\ElasticSearch\elasticsearch-1.3.1\bin>start /B elasticsearch
C:\Users\User1\Desktop\Work\ElasticSearch\elasticsearch-1.3.1\bin>start /B elasticsearch
C:\Users\User1\Desktop\Work\ElasticSearch\elasticsearch-1.3.1\bin>[2014-08-19 15:23:26,351][WARN ][bootstrap ] jvm uses the c
lient vm, make sure to run `java` with the server vm for best performance by adding `-server` to the command line
[2014-08-19 15:23:26,433][INFO ][node ] [Batroc the Leaper] version[1.3.1], pid[5800], build[2de6dc5/2014-07-28T14:45:15
Z]
The process runs on port 9200.
How can I get the process PID or name to use taskkill to kill this process using this command or something similar from either the already open command prompt or the existing command prompt in which the elasticsearch node process is running:
taskkill /PID <pid>
Pid of 5800(shown in process log in console above) did not work. Windows task manager did not have a process by the name elasticsearch. It only has a cmd process for the command prompt in which the elasticsearch is running and when I kill that process, the elasticsearch also gets killed.
I'd install and run Elasticsearch as a Windows service:
Windows users can configure Elasticsearch to run as a service to run in the background or start automatically at startup without any user interaction. This can be achieved through service.bat script under bin/ folder which allows one to install, remove, manage or configure the service and potentially start and stop the service, all from the command-line.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/setup-service-win.html
It let's you run commands like start and stop to run and terminate elasticsearch from a script without having to track process ids or keep the same command prompt open.
UPDATE:
To run multiple instances of Elasticsearch at the same time as services you will need to pass in a unique serviceid when installing the service:
The script requires one parameter (the command to execute) followed by an optional one indicating the service id (useful when installing multiple Elasticsearch services).
Regarding what port and IP address ES is running on it should be no different - but I'd check your config files (elasticsearch.yml) and your logging config (logging.yml). More detail on configuration options here:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/setup-configuration.html