So I had ES installed in local directory, and I had indices there. I decided to use deb package and installed it system wide (running under elasticsearch user)
Then I went and found the data directory of new instance. I configured new es to run on same port as old and disabled the old one
Then I went and copied the data/nodes directory to new instance's data directory (after removing old directory) so now both old and new ES data directories are identical
I have enabled systemctl
systemctl daemon-reload && systemctl enable elasticsearch
But when I reboot the system it throws an error
[2019-10-25T14:02:17,539][INFO ][o.e.n.Node ] [myserver.com] stopping ...
[2019-10-25T14:02:17,666][INFO ][o.e.x.w.WatcherService ] [myserver.com] stopping watch service, reason [shutdown initiated]
[2019-10-25T14:02:17,668][INFO ][o.e.x.w.WatcherLifeCycleService] [myserver.com] watcher has stopped and shutdown
[2019-10-25T14:02:17,828][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [myserver.com] [controller/5021] [Main.cc@150] Ml controller exiting
[2019-10-25T14:02:17,829][INFO ][o.e.x.m.p.NativeController] [myserver.com] Native controller process has stopped - no new native processes can be started
[2019-10-25T14:02:17,848][DEBUG][o.e.a.a.i.s.TransportIndicesStatsAction] [myserver.com] failed to execute [indices:monitor/stats] on node [e1tNwwKsRI2ID8UqgyGszA]
org.elasticsearch.transport.SendRequestTransportException: [myserver.com][127.0.0.1:9300][indices:monitor/stats[n]]
at org.elasticsearch.transport.TransportService.sendRequestInternal(TransportService.java:704) ~[elasticsearch-7.4.1.jar:7.4.1]
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor.sendWithUser(SecurityServerTransportInterceptor.java:162) ~[?:?]
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor.access$300(SecurityServerTransportInterceptor.java:53) ~[?:?]
[... skipped stack trace - i am sure it's not going to add anything to the solution]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:830) [?:?]
Caused by: org.elasticsearch.transport.TransportException: TransportService is closed stopped can't send request
at org.elasticsearch.transport.TransportService.sendRequestInternal(TransportService.java:686) ~[elasticsearch-7.4.1.jar:7.4.1]
... 28 more
[2019-10-25T14:02:17,848][DEBUG][o.e.a.a.c.n.s.TransportNodesStatsAction] [myserver.com] failed to execute on node [e1tNwwKsRI2ID8UqgyGszA]
org.elasticsearch.transport.SendRequestTransportException: [myserver.com][127.0.0.1:9300][cluster:monitor/nodes/stats[n]]
at org.elasticsearch.transport.TransportService.sendRequestInternal(TransportService.java:704) ~[elasticsearch-7.4.1.jar:7.4.1]
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor.sendWithUser(SecurityServerTransportInterceptor.java:162) ~[?:?]
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor.access$300(SecurityServerTransportInterceptor.java:53) ~[?:?]
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$1.sendRequest(SecurityServerTransportInterceptor.java:129) ~[?:?]
at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:602) ~[elasticsearch-7.4.1.jar:7.4.1]
at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:590) ~[elasticsearch-7.4.1.jar:7.4.1]
at org.elasticsearch.action.support.nodes.TransportNodesAction$AsyncAction.start(TransportNodesAction.java:182) ~[elasticsearch-7.4.1.jar:7.4.1]
[... skipped stack trace - i am sure it's not going to add anything to the solution]
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:129) ~[elasticsearch-7.4.1.jar:7.4.1]
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:64) ~[elasticsearch-7.4.1.jar:7.4.1]
But I can start manually with no problems
service elasticsearch start