Elasticsearch service does not run at statup on Ubuntu 16.04 - elasticsearch

I installed elasticsearch on Ubuntu 16.04.
When I enter sudo service elasticsearch start, everything works.
But the service is not running on startup. Before starting it manually, sudo service elasticsearch status gives me:
elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vend
Active: inactive (dead)
Docs: http://www.elastic.co
I tried to add it to startup with:
sudo update-rc.d elasticsearch defaults and sudo update-rc.d elasticsearch enable, but this changes nothing.
What could be the problem, and how can I debug this?

The answer to your problem is running this:
sudo systemctl enable elasticsearch.service
Elasticsearch on Ubuntu 16.04 uses SystemD not System V anymore.
For some reason when (as of 9th Jan 2016) you install ES 5.1 (not sure if other versions are affected) from APT by default this service does not start.

Did not find the error. Just reinstalled it with dpkg. Works, and the data and config hasn`t been overwritten.

Related

Failed to restart supervisor.service: Unit not found CentOS 7

I am trying to use laravel queue:work on live server and keep alive the work using Supervisor. After configuration it shows as follows:
[root#vmi485931 supervisord.d]# sudo supervisorctl reload
Restarted supervisord
[root#vmi485931 supervisord.d]# sudo service supervisor restart
Redirecting to /bin/systemctl restart supervisor.service
Failed to restart supervisor.service: Unit not found.
Any clue?
there are some package missing in Centos 7. i had some issue on centos 7 and i fixed issue with this commands :
1- need python-meld3 package
sudo rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/python-meld3-0.6.10-1.el7.x86_64.rpm
2-needs supervisor lib.
sudo rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/s/supervisor-3.4.0-1.el7.noarch.rpm
If you are trying to restart the processes that are run by supervisor, run
sudo supervisorctl restart all
You can use supervisor process name instead of 'all' to restart a specific process.
If you are trying to restart supervisor itself,sudo systemctl restart supervisor should work.

Failed to restart mysql.service: Unit mysql.service is masked in Ubuntu 20.04 after an upgrade from 18.4

I upgraded my ubuntu from ubuntu 18.04 to ubuntu 20.04. On running my MySQL via the terminal, I am not able to access my DBS on running the command
service MySQL start
I get the error message
Unit mysql.service is masked.
If you are receiving the error message
MySQL services are masked
I simply solved mine by running the below code
systemctl unmask mysql.service
Then restart your MySQL
service mysql start

Debian Stretch: Mosquitto Unit mosquitto.service is masked

I'm trying to set up mosquitto under RPi - Debian Stretch.
sudo service mosquitto giving me following returncode:
Failed to start mosquitto.service: Unit mosquitto.service is masked.
sudo service mosquitto status:
● mosquitto.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
Can somebody give me a hint how to fix it?
Thank you!
Fix it with
sudo systemctl unmask mosquitto service
sudo service mosquitto stop
sudo service mosquitto start
Its running now! – Andreas

apache mesos is not recognized as a service in a ubuntu linux environment

Hi I am trying to install apache mesos in my ubuntu based system. I have installed zookeeper and marathon along with this setup.
apt-get install mesos marathon
it says its success but when i try to see available services systems does not show mesos-master or slaves as available services. also
service mesos-master/slave start
says unrecognized service. any idea?
I had the same issue, so after trying multiple tricks .. I found that you can start the mesos-master using the following command:
mkdir ~/workdir; sudo mesos master --work_dir=/home/azureuser/wokdir&
Some documentation has not matched actual installations for me - Mesos may installed to be managed by upstart/systemd kinds of commands rather than service. Most recently for me, a CentOS 6.6 install of Mesos has landed in upstart-managed territory, e.g.:
start mesos-master
stop mesos-master
status mesos-master
YMMV, but that's what I've recently seen.
I faced same issue, I was not able to start mesos-master on UBUNTU-14.04 although I double checked installation and zookeeper service started successfully and tested well.
I found work around to start mesos-master service.
$ cd /usr/sbin/
$ sudo ./mesos-master --work_dir=/var/lib/mesos --log_dir=/home/rajeev/logs/mesos/
above command run mesos-master service successfully [But sudo service mesos-master start command failed to start mesos master node]

What's a clean way to stop mongod on Mac OS X?

i'm running mongo 1.8.2 and trying to see how to cleanly shut it down on Mac.
on our ubuntu servers i can shutdown mongo cleanly from the mongo shell with:
> use admin
> db.shutdownServer()
but on my Mac, it does not kill the mongod process. the output shows that it 'should be' shutdown but when i ps -ef | grep mongo it shows me an active process. also, i can still open a mongo shell and query my dbs like it was never shutdown.
the output from my db.shutdownServer() locally is:
MongoDB shell version: 1.8.2
connecting to: test
> use admin
switched to db admin
> db.shutdownServer()
Tue Dec 13 11:44:21 DBClientCursor::init call() failed
Tue Dec 13 11:44:21 query failed : admin.$cmd { shutdown: 1.0 } to: 127.0.0.1
server should be down...
Tue Dec 13 11:44:21 trying reconnect to 127.0.0.1
Tue Dec 13 11:44:21 reconnect 127.0.0.1 failed couldn't connect to server 127.0.0.1
Tue Dec 13 11:44:21 Error: error doing query: unknown shell/collection.js:150
i know i can just kill the process but i'd like to do it more cleanly.
It's probably because launchctl is managing your mongod instance. If you want to start and shutdown mongod instance, unload that first:
launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
Then start mongod manually:
mongod -f path/to/mongod.conf --fork
You can find your mongod.conf location from ~/Library/LaunchAgents/org.mongodb.mongod.plist.
After that, db.shutdownServer() would work just fine.
Added Feb 22 2014:
If you have mongodb installed via homebrew, homebrew actually has a handy brew services command. To show current running services:
brew services list
To start mongodb:
brew services start mongodb-community
To stop mongodb if it's already running:
brew services stop mongodb-community
Update*
As edufinn pointed out in the comment, brew services is now available as user-defined command and can be installed with following command: brew tap gapple/services.
If you installed mongodb with homebrew, there's an easier way:
List mongo job with launchctl:
launchctl list | grep mongo
Stop mongo job:
launchctl stop <job label>
(For me this is launchctl stop homebrew.mxcl.mongodb)
Start mongo job:
launchctl start <job label>
Simple way is to get the process id of mongodb and kill it.
Please note DO NOT USE kill -9 pid for this as it may cause damage to the database.
so,
1. get the pid of mongodb
$ pgrep mongo
you will get pid of mongo, Now
$ kill
You may use kill -15 as well
If you have installed mongodb community server via homebrew, then you can do:
brew services list
This will list the current services as below:
Name Status User Plist
mongodb-community started <your_user_name> /Users/<your_user_name>/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
redis stopped
Then you can restart mongodb by first stopping and restart:
brew services stop mongodb
brew services start mongodb
I prefer to stop the MongoDB server using the port command itself.
sudo port unload mongodb
And to start it again.
sudo port load mongodb
Check out these docs:
http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo#StartingandStoppingMongo-SendingaUnixINTorTERMsignal
If you started it in a terminal you should be ok with a ctrl + 'c' -- this will do a clean shutdown.
However, if you are using launchctl there are specific instructions for that which will vary depending on how it was installed.
If you are using Homebrew it would be launchctl stop homebrew.mxcl.mongodb
The solutions provided by others used to work for me but is not working for me anymore, which is as below.
brew services stop mongodb
brew services start mongodb
brew services list gives
Name Status User Plist
mongodb-community started XXXXXXXXX /Users/XXXXXXXXX/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
So I used mongodb-community instead of mongodb which worked for me
brew services stop mongodb-community
brew services start mongodb-community
This is an old question, but its one I found while searching as well.
If you installed with brew then the solution would actually be the this:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
If the service is running via brew, you can stop it using the following command:
brew services stop mongodb

Resources