I've using the standard init.d script that comes with CouchDB. I'm using it on Ubuntu.
On server restart, this is printed on local console:
* Starting database server couchdb [ OK ]
So, it's assumed that CouchDB was started, but not. CouchDB is not started.
I must log into the server and start service with service couchdb start, then CouchDB was started correctly.
Any idea in how to debug why CouchDB is not started on reboot ? Already done the update-rc.d command.
Related
I have 3 servers running a MongoDB replica set.
I currently start the node like this after restarting a server:
mongod --replSet "name_of_replicaset" --bind_ip localhost,this_server_hostname_in_host_file --fork --syslog --auth --keyFile "path_to_file"
The problem is that I have to do this every single time I restart a server.
I've checked online and the official documentation for MongoDB but I cannot find a way to make the server startup the node by itself.
Is there a way to have the server startup the node after it restarting?
You can do this using systemctl.
Create a service for this and enable the same via systemctl enable command. It will automatically start once you restart the server.
I'm using MongoDB, Node.js and Ubuntu 16.04 OS.
I set up MongoDB database from mongo CLI. I also communicated with it using node.js's mongodb library.
I thought I should start the database first (and start listening on the port) with mongod command.
But now I didn't start the database with mongod and still my communication from node.js towards database works fine.
Should mongod be run prior to communication with database, or is mongod process still alive from restart (I cannot find it listed in processes), or maybe my node.js code stores data in local variables that I haven't notice?
check on your ubuntu:
ps aux | grep mongod
if you see a process then it's running.
You can also write: top
With top you will see the current status of your system along with all the processes running.
With ps au you only see all process that are not attached to your TTY
I have created a Systemd unit file to run Mongodb on system startup. I have also created a systemd service to run my node application on startup after mongodb is started. The service for mongodb works fine, but for some reason my service for the Node application tries to run and then gives the error: "MongoError: failed to connect to server [localhost:27017] on first connect". If I start the mongodb service using $systemctl start mongodb and then start my Node application using $/usr/bin/node /node_app_slot/server.js It seems to work fine. So the problem seems to be with my systemd unit file for my Node server.
I used this for the mongodb systemd service https://gist.github.com/jwilm/5842956
And here is my node_server.service:
[Unit]
Wants=network.target mongodb.service
After=network.target mongodb.service
[Service]
ExecStart=/usr/bin/node /node_app_slot/server.js
[Install]
WantedBy=multi-user.target
Im doing this on an intel edison set up in Access Point mode using hostapd. The OS is Yocto and is up to date with the latest release.
I can't see where Im going wrong. I will really appreciate it if someone could guide me in the right direction!
Thanks!
Your systemd syntax is correct, although you may want to use the network-online.target instead of network.target.
A workaround to consider is to add a 5 second sleep before your MongoDB app starts. Since this is happening at server boot time, the extra 5 seconds are unlikely to make a practical difference but may solve your problem.
ExecStartPre=/bin/sleep 5
It is curious that you are copy/pasting a MongoDB systemd service file from the internet when MongoDB ships with their own systemd service files. You didn't mention your OS version, systemd version or MongoDB version, but I would still recommend referencing the official MongoDB systemd configuration files if aren't using a version of MongoDB that ships with the files.
I had similar problem. The problem may be the fact that you try to connect before the network service has finished starting. You can take a look at here to see if it solves your problem:
https://unix.stackexchange.com/questions/126009/cause-a-script-to-execute-after-networking-has-started
all,
I met a very serious problem about my couchdb. I install the couchdb on a virtual machine, the system is ubuntu. The disk of this ubuntu is 10G, I asked the couchdb to catch data from twitter but I was not aware that the couchdb occupy all the disk storage in the system. To get some storage to run the couchdb, I have delete the system log. Then I type: sudo service couchdb start, it is start, but the http://127.0.0.1:9000/_utils/cannot open. All show in the following. Is anyone can help?? I am really anxious, because all my data is store only in this couchdb.
Documentation: https://help.ubuntu.com/
ubuntu#election2:~$ sudo service couchdb status
couchdb stop/waiting
ubuntu#election2:~$ sudo service couchdb start
couchdb start/running, process 1325
ubuntu#election2:~$ sudo service couchdb status
couchdb stop/waiting
ubuntu#election2:~$ sudo service couchdb stop
stop: Unknown instance:
ubuntu#election2:~$ sudo service couchdb restart
stop: Unknown instance:
couchdb start/running, process 1601
ubuntu#election2:~$
if this couchdb is difficult to repair, is anyone can tell me how can I remove the data in this couchdb wihtout starting it.There must be some tangible document. Thank you in advance!!!!
There are two CouchDB configuration files, default.ini and local.ini. My default.ini contains an entry in the [couchdb] section called database_dir which specifies where couch databases are stored. To find your configuration files run: couchdb -c. Your database .couch file will have the same name as you would have seen in the web interface. To remove the database, delete the file. If you want to keep the data, move it to a different location.
Shut down couch using: couchdb -d or sudo service couchdb stop depending on how you started it.
Once shut down you can copy / move the couchdb database directory to a location with more space. Change your database_dir setting to the new location and restart couchdb with: couchdb -b or sudo service couchdb start
The data is stored as a db file with the name of the CouchDB bucket in a dictionary that is specified in the local.ini as database_dir. Delete the file and the data is gone.
The running CouchDB can be killed by kill :pid. The :pid is a number (process id) and can be investigated with the command ps -ax | grep "couchdb"
I installed single node cluster in my local dev box which is running Windows 7 and it was working fine. Due to some reason, I need to restart my desktop and then after that whenever I am doing like this on the command prompt, it always gives me the below exception-
S:\Apache Cassandra\apache-cassandra-1.2.3\bin>cassandra -f
Starting Cassandra Server
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 7199; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
Meaning port being used somewhere. I have made some changes in cassandra.yaml file so I need to shutdown the Cassandra server and then restart it again.
Can anybody help me with this?
Thanks for the help.
in windows7, with apache cassandra, a pid.txt file gets created at the root folder of cassandra. Give following instruction to stop the server:
d:/cassandra/bin> stop-server -p ../pid.txt -f
Running -f starts the server as a service, you can stop it through the task manager.
It sounds like your Cassandra server starts on it's own as a service in the background when your machine boots. You can configure windows startup services. To run cassandra in the foreground on windows simply use:
> cassandra.bat
If your are using Cassandra bundled with DataStax Community Edition and running as a service on startup of your machine then you can execute following commands to start and stop Cassandra server.
Start command prompt with admin rights
run following commands
net start DataStax_Cassandra_Community_Server
net stop DataStax_Cassandra_Community_Server