Elasticsearch connection error in Ubuntu 16.4 - linux

In my ubuntu machine when I run the command curl -X GET 'http://localhost:9200' to test connection it show following message.
curl: (7) Failed to connect to localhost port 9200: Connection refused
When i check server status with sudo systemctl start elasticsearch it show following message.
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2016-11-20 16:32:30 BDT; 44s ago
Docs: http://www.elastic.co
Process: 8653 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs=${LOG_DIR} -Edefa
Process: 8649 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 8653 (code=exited, status=1/FAILURE)
Nov 20 16:32:29 bahar elasticsearch[8653]: 2016-11-20 16:32:25,579 main ERROR Null object returned for RollingFile in Appenders.
Nov 20 16:32:29 bahar elasticsearch[8653]: 2016-11-20 16:32:25,579 main ERROR Null object returned for RollingFile in Appenders.
Nov 20 16:32:29 bahar elasticsearch[8653]: 2016-11-20 16:32:25,580 main ERROR Unable to locate appender "rolling" for logger config "root"
Nov 20 16:32:29 bahar elasticsearch[8653]: 2016-11-20 16:32:25,580 main ERROR Unable to locate appender "index_indexing_slowlog_rolling" for logge
Nov 20 16:32:29 bahar elasticsearch[8653]: 2016-11-20 16:32:25,581 main ERROR Unable to locate appender "index_search_slowlog_rolling" for logger
Nov 20 16:32:29 bahar elasticsearch[8653]: 2016-11-20 16:32:25,581 main ERROR Unable to locate appender "deprecation_rolling" for logger config "o
Nov 20 16:32:29 bahar elasticsearch[8653]: [2016-11-20T16:32:25,592][WARN ][o.e.c.l.LogConfigurator ] ignoring unsupported logging configuration
Nov 20 16:32:30 bahar systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Nov 20 16:32:30 bahar systemd[1]: elasticsearch.service: Unit entered failed state.
Nov 20 16:32:30 bahar systemd[1]: elasticsearch.service: Failed with result 'exit-code'.

This is the error for the PATH and LOgs in the elasticsearch.yml (etc/elasticsearch/elasticsearch.yml)
Uncheck these path and your error will be removed.

That means elasticsearch is not running. And from what I see, there is a problem with starting it. Check your elasticsearch configuration.

check if Elasticsearch is running,run the follwing command:
$ ps aux|grep elasticsearch
if Elasticsearch is not started,check your JAVA Environment,download a new Elasticsearch and install it again:
1.check if JAVA is correctly installed:
$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
if your JAVA version is lower 1.7,change a new one.
2.download Elasticsearch install package,unzip it:
$ tar -zxvf elasticsearch-2.3.3.gz
3. run Elasticsearch
$ cd elasticsearch-2.3.3
$ ./bin/elasticsearch

Usually it's the write permission issue for the log directory (default as /var/log/elasticsearch), use ls -l to check the permission and change mode to 777 for the log directory and files if necessary.

Long story short: a system reboot might get it OK.
It has been a while since the question is asked. Anyway, I ran into a similar problem recently.
The elasticsearch service on one of my nodes died, with error saying similar to those posted in the question when restart the service. It says the log folder to write is read-only file system. But these files and directories are indeed owned by user elasticsearch (version 5.5, deployed on Cent OS 6.5), there should not be a read-only problem.
I checked and didn't find a clue. So, I just reboot the system. After rebooting, everything goes all right without any further tuning: elasticsearch service starts on boot as configured, it finds the cluster and all the other nodes, and the cluster health status turns green after a little while.
I guess, the root reason might be some hardware failure in my case. All data and logs managed by elasticsearch cluster are stored in a 2TB SSD driver mounted on each node. And our hardware team just managed to recover from an external storage failure recently. All the nodes restarted during that recovery. Chances are there are some lagged issues caused the problem.

Related

How to fix permission denied issue RedisJson?

When I try to load a redis module with loadmodule in redis.conf, redis-server crashes.
The log shows
Module /etc/modules/librejson.so failed to load: /etc/modules/librejson.so: unable to open shared objects file: Permission denied.
I have read the documentation to install RedisJson, but it does not work for me.
If I comment loadmodule line, the server works fine.
Installation process
sudo dnf update
sudo dnf upgrade
sudo dnf install redis
Configuration
cd /etc/redis
nvim /redis.conf
loadmodule loadmodule /etc/modules/librejson.so
supervised systemd
The rest of the file is kept by default
What I did
I created modules folder inside etc folder
I ran chown redis:root over modules folder
I moved the module to /etc/modules because I had read that homeprotection can block redis when trying to read the module in the /home path.
Then I used ls -l to check permissions and owners:
-rwxr-xr-x. 2 user user user 23668904 Feb 15 09:10 librejson.so
after that, I ran chown redis:root (as redis.conf owners): -rwxr-xr-xr-x. 2 redis root 23668904 Feb 15 09:10 librejson.so
and when I ran sudo systemctl restart redis.service:
Job for redis.service failed because the control process exited with error code.
See "systemctl status redis.service" and "journalctl -xeu redis.service" for details.
systemctl status redis.service:
redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
└─limit.conf
Active: failed (Result: exit-code) since Thu 2023-02-16 13:21:58 CST; 6min ago
Process: 28947 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --daemonize no --supervised systemd (code=exited, status=1/FAILURE)
Main PID: 28947 (code=exited, status=1/FAILURE)
Status: "Redis is loading..."
CPU: 10ms
Feb 16 13:21:58 fedora systemd[1]: Starting redis.service - Redis persistent key-value database...
Feb 16 13:21:58 fedora systemd[1]: redis.service: Main process exited, code=exited, status=1/FAILURE
Feb 16 13:21:58 fedora systemd[1]: redis.service: Failed with result 'exit-code'.
Feb 16 13:21:58 fedora systemd[1]: Failed to start redis.service - Redis persistent key-value database.
and nothing, I ran out of ideas.
System specs
Fedora 37
Redis server v=7.0.8

Elastisearch Enabling Remote Connection - Crashes AFTER Change*

I just installed filebeat, logstash, kibana and elasticsearch all running smoothly just to trial this product out for additional monthly reports/monitoring and noticed every time I try to change the "/etc/elasticsearch/elasticsearch.yml" config file for remote web access it'll basically crash the service every time I make the change.
Just want to say I'm new to the forum and this product, and my end goal for this question is to figure out how to allow remote connections to access elastisearch as I guinea pig and test without crashing elasticsearch.
For reference here is the error code when I run the 'sudo systemctl status elasticsearch' query:
Dec 30 07:27:37 ubuntu systemd[1]: Starting Elasticsearch...
Dec 30 07:27:52 ubuntu systemd-entrypoint[4067]: ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
Dec 30 07:27:52 ubuntu systemd-entrypoint[4067]: bootstrap check failure [1] of [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.se>
Dec 30 07:27:52 ubuntu systemd-entrypoint[4067]: ERROR: Elasticsearch did not exit normally - check the logs at /var/log/elasticsearch/elasticsearch.log
Dec 30 07:27:53 ubuntu systemd[1]: elasticsearch.service: Main process exited, code=exited, status=78/CONFIG
Dec 30 07:27:53 ubuntu systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Dec 30 07:27:53 ubuntu systemd[1]: Failed to start Elasticsearch.
Any help on this is greatly appreciated!

MongoDB: expection: connect failed, exiting with code 1

So after installing mongodb in my Ubuntu, I tried to run "mongo", but it said,
MongoDB shell version v4.4.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
So I enabled mongod service and started it, then ran the command,
sudo systemctl status mongod
And It said,
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2020-09-17 00:23:08 +06; 8min ago
Docs: https://docs.mongodb.org/manual
Process: 45414 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, sta>
Main PID: 45414 (code=exited, status=1/FAILURE)
Sep 17 00:23:08 john systemd[1]: Started MongoDB Database Server.
Sep 17 00:23:08 john mongod[45414]: about to fork child process, waiting until server is>
Sep 17 00:23:08 john mongod[45427]: forked process: 45428
Sep 17 00:23:08 john mongod[45414]: ERROR: child process failed, exited with error numbe>
Sep 17 00:23:08 john mongod[45414]: To see additional information in this output, start >
Sep 17 00:23:08 john systemd[1]: mongod.service: Main process exited, code=exited, statu>
Sep 17 00:23:08 john systemd[1]: mongod.service: Failed with result 'exit-code'.
And I can't run the mongodb shell. What should I do?
I came across this issue yesterday and I was able to resolve it by:
removing the mongod.lockfile.
running the config fork command.
remove .lock file:
sudo rm /usr/local/var/mongodb/mongod.lock
Run:
mongod --config /usr/local/etc/mongod.conf --fork.
and use the mongo command again.
mongod need to be running before you can run mongo without that error.
p.s. here is the answer for others who stumble upon original question from the title
I also got that same error , I think this may happened because of some updation in our PC (like .NET framework updation something)
then I uninstalled and reinstalled MongoDB again and its working
You have yo go /etc , modify the mongod.conf, because:
"By default, MongoDB launches with bindIp set to 127.0.0.1,", which binds to the localhost network interface. This means that the mongod can only accept connections from clients that are running on the same machine.
Then could sudo nano mongod.conf and change 127.0.0.1 to 0.0.0.0
You must restart mongo.
Create a folder data in root C: directory.
Create another folder db inside data folder.
Now run mongod in cmd in path
C:\Program Files\MongoDB\Server\5.0\bin>mongo
Don't close this command prompt.
Open another cmd in same path
C:\ProgramFiles\MongoDB\Server\5.0\bin>mongo
Run mongo command.
Now it will connect.

Jboss 7.0 Fails to start in Red Hat

Hi, i'm trying to run Jboss EAP 7.0.0 in Red Hat Enterprise Linux 7, the installation goes well until i need to start the service.
sudo service jboss-eap-rhel start
Redirecting to /bin/systemctl start jboss-eap-rhel.service
Job for jboss-eap-rhel.service failed. See 'systemctl status jboss-eap-rhel.service' and 'journalctl -xn' for details.
After reach for the service log, it shows that the JBoss EAP startup script has failed to start.
localhost.localdomain systemd1: Failed to start SYSV: JBoss EAP startup script.
systemctl status jboss-eap-rhel.service
jboss-eap-rhel.service - SYSV: JBoss EAP startup script
Loaded: loaded (/etc/rc.d/init.d/jboss-eap-rhel.sh)
Active: failed (Result: resources) since Wed 2017-05-17 05:35:37 EDT; 6min ago
Process: 16673 ExecStart=/etc/rc.d/init.d/jboss-eap-rhel.sh start (code=exited, status=0/SUCCESS)
Main PID: 6979
May 17 05:35:06 localhost.localdomain systemd[1]: Starting SYSV: JBoss EAP startup script...
May 17 05:35:06 localhost.localdomain jboss-eap-rhel.sh[16673]: Starting jboss-eap: chown: missing operand after ‘/var/run/jboss-eap’
May 17 05:35:06 localhost.localdomain jboss-eap-rhel.sh[16673]: Try 'chown --help' for more information.
May 17 05:35:37 localhost.localdomain jboss-eap-rhel.sh[16673]: jboss-eap started with errors, please see server log for details
May 17 05:35:37 localhost.localdomain jboss-eap-rhel.sh[16673]: [ OK ]
May 17 05:35:37 localhost.localdomain systemd[1]: PID file /var/run/jboss-eap/jboss-eap.pid not readable (yet?) after start.
May 17 05:35:37 localhost.localdomain systemd[1]: Failed to start SYSV: JBoss EAP startup script.
May 17 05:35:37 localhost.localdomain systemd[1]: Unit jboss-eap-rhel.service entered failed state.
i checked the jboss conf and the eap-rhel.sh looking for something wrong, including the standalone.xml and the standalone-full.xml, but everything looks to be ok.
the files of the jboss are in /usr/share right now (i have installed and unstalled several times in different folders trying to solve it, yes i have deleted remaining files before each installation).
just to be sure, i mention the steps i done after every installation:
the jboss-eap.conf was succefully edited. the user and the path of the jboss were changed to the right ones.
jboss-eap.conf copied to /etc/default
jboss-eap-rhel copied to /etc/init.d
I also opened it using
./standalone.sh -c standalone-full.xml
it throws this warning:
03:56:23,735 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 60) WFLYTX00 13: Node identifier property is set to the default value. Please make sure it is unique.
and doesn't work (because the service is still not active).
¿how can I start the service?
03:56:23,735 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 60) WFLYTX0013: Node identifier property is set to the default value. Please make sure it unique.
You dont have to worry about it unless you have enabled JTA. You can set unique value of node identifier in standalone-full.xml file like :
<subsystem xmlns="urn:jboss:domain:transactions:1.4">
<core-environment node-identifier="${jboss.tx.node.id}">
...
Regarding service, please verify steps you have followed http://www.dmartin.es/2014/07/jboss-eap-6-as-rhel-7-service/
If you're using JBoss 7.x, you can use the following CLI commands:
/host=master/server-config=server-one/system-property=jboss.tx.node.id:add(boot-time=true,value=master)
/host={slave-host}/server-config=server-one/system-property=jboss.tx.node.id:add(boot-time=true,value=slave2)
/profile={some-profile}/subsystem=transactions:write-attribute(name=node-identifier,value="${jboss.tx.node.id}")
:reload-servers(blocking=true)
This will add the following lines:
<subsystem xmlns="urn:jboss:domain:transactions:4.0">
<core-environment node-identifier="${jboss.tx.node.id}">
<process-id>
<uuid/>
</process-id>
</core-environment>
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
<object-store path="tx-object-store" relative-to="jboss.server.data.dir"/>
</subsystem>
In each profile section of the domain.xml configuration file (in domain controller), and:
<servers>
<server name="server-one" group="x-server-group" auto-start="true">
<system-properties>
<property name="jboss.tx.node.id" value="slave1" boot-time="true"/>
</system-properties>
</server>
</servers>
under each server definition in the host-slave.xml configuration file (in host controller).
External references:
https://access.redhat.com/solutions/748323
https://access.redhat.com/solutions/260023
https://issues.jboss.org/browse/JBEAP-11208

Unable to start jenkins on redhat

I dowloaded and installed jenkins with the following commands on redhat
(3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux)
sudo wget https://pkg.jenkins.io/redhat-stable/jenkins-2.32.2-1.1.noarch.rpm
rpm -ivh jenkins-2.32.2-1.1.noarch.rpm
And I started jenkins with the command
sudo service jenkins start
I got the output
Starting jenkins (via systemctl): [ OK ]
But jenkins is not running.
I tried ps ax | grep -i jenkins and no process named jenkins is running.
I tried service --status-all and i can't see jenkins.
I tried to access ip:8080 which is also not showing anything.
But with systemctl status jenkins.service I can see that it started
● jenkins.service - LSB: Jenkins Continuous Integration Server
Loaded: loaded (/etc/rc.d/init.d/jenkins)
Active: active (exited) since Fri 2017-02-10 16:07:42 EST; 2min 7s ago
Docs: man:systemd-sysv-generator(8)
Process: 16649 ExecStop=/etc/rc.d/init.d/jenkins stop (code=exited, status=0/SUCCESS)
Process: 16672 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
Feb 10 16:07:42 AWSINTDEV11.equinoxfitness.com systemd[1]: Starting LSB: Jenkins Continuous Integration Server...
Feb 10 16:07:42 AWSINTDEV11.equinoxfitness.com runuser[16673]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Feb 10 16:07:42 AWSINTDEV11.equinoxfitness.com jenkins[16672]: Starting Jenkins [ OK ]
Feb 10 16:07:42 AWSINTDEV11.equinoxfitness.com systemd[1]: Started LSB: Jenkins Continuous Integration Server.
For future reference and those who doesn't bother to read the comments. Besides checking the system logs you should check the Jenkins log, which on most *nix systems is located in /var/log/jenkins/jenkins.log. In this case it was insufficient permissions to /var/libs/jenkins.
BTW, If you can't find any errors in that log either, then you probably have some sort of ip-table issue where the Jenkins server can't be accessed from the outside.

Resources