magento2.4 – Job for elasticsearch.service failed because the control process exited with error code. See “systemctl status elasticsearch.service” and “journalctl

Solution:

Error Screenshot
enter image description here

To Fix This, edit /etc/sysconfig/elasticsearch

vi /etc/sysconfig/elasticsearch

Press i for insert text then move to bottom,

add below code in end of the page

ES_TMPDIR=/var/log/elasticsearch

To Save File, Click ESC then type :wq to save and exit.

Start Elastic search now

systemctl start elasticsearch

To Verify it’s services running

systemctl status elasticsearch

To Confirm Elasticsearch running

curl localhost:9200