On Windows Subsystem for Linux running Ubuntu 16.04, I've installed InfluxDB 1.4.2 according to the Influx documentation. I can't run it as a service or with systemctl, probably because WSL doesn't support that (see GitHub issues 994 and 1579), so neither of these work:
$ sudo service influxdb start
influxdb: unrecognized service
$ sudo systemctl start influxdb
Failed to connect to bus: No such file or directory
If I run $ sudo influxd, Influx starts, but then crashes with the message
run: open server: open tsdb store: cannot allocate memory
How do I fix the "cannot allocate memory" error?
On Win10 Spring 2018 Update, I ran the following:
sudo apt install influxdb influxdb-client -y
Installed fine.
As per the docs …
… started the service using:
sudo service influxdb start
Started fine:
Let's connect, examine and create a database:
Please let me know if I've done anything wrong here to repro, otherwise, looks like this issue has been resolved.
I just had this problem when installing in WSL but systemd was installed. When installing the influxdb package it registered a systemd unit so I was unable to start it using init.d. I solved this using this guide. Instead of the dead link to the init.sh script i searched for an older version and found this.
Steps to get InfluxDB working in WSL (at least when systemd is installed):
Install influxdb using sudo apt install influxdb
Copy the content of this file into a new file at location /etc/init.d/influxdb
You can now start influxdb using sudo service influxdb start.
For me it showed an error message while starting but it still started correctly.
Bit of a strange problem. I'm in ~/My Programs/app2. I run 'rails s' and it starts the application located in ~/My Programs/app1 on localhost:3000. Any idea why this might be happening?
No error messages..
I am thinking that your server for app1 is still running
try rails s -p 4000
and go to localhost:4000 that should bring you to your app
Remove rails detached server by using command
ps -aef | grep rails
OR by this command
lsof -wni tcp:3000
then
kill -9 pID
I am trying to start rails server using rails s command. But i'm getting the following error:
A server is already running. Check repo/tmp/pids/server.pid.
I checked the file, but its blank. There is no id in the server.pid file. Then I tried to find out the process running on port 3000 using the command lsof -wni tcp:3000. It also does not show any id.
Then I tried starting the server on a different port using rails s -p 3001, but this also gives the same error. Please could someone explain what is going on.
Thanks
EDIT: does not work even after restarting computer
Just remove the file then:
rm repo/tmp/pids/server.pid
Try running this command in your terminal window.
kill -9 $(lsof -i tcp:3000 -t)
If it doesn't work, you can always just restart your computer/server...
1- Use the command below for checking that how many server currently running
$ ps aux | grep rails
2- For killing the existing server
$ kill -9 pid
I am running a rails 3.2 application on amazon ec2 in development environment and detach mode.
$ rails s -d
After this command the ec2 terminal hangs and does not come out of this command but the server starts as I can access the application.I have to close the terminal and the server remains started.
After this I kill the application.
$ lsof|grep 3000
$ kill -9 <pid>
Now if I try to restart the server, it gives error.
A server is already running. Check /home/ubuntu/trade_ship/tmp/pids/server.pid.
Exiting
Now even if I delete the tmp folder and recreate it, the server won't start. Can anyone help me with these two issues?
Even I had faced that issue, try to restart your system and then check.. this solution worked for me at that time.
First of all if you are not able to use port 3000 use rails s -p <port no> command
Second is if you have to kill the RUBY instance which server started so use
ps aux | grep ruby
username 17731 0.1 1.6 3127008 67996 ?? S 2:00PM 0:01.42 /Users/username/.rvm/rubies/ruby-1.9.2-p180/bin/ruby script/rails s -d
and then kill
kill -9 17731
This will definitely solve the issue
When I am starting rails server using rails s command it is showing A server is already running. Check C:/Sites/folder/Pids/Server.pids
When I open the file it is outputting a 4 digit number only so how could I resolve this issue ?
FYI
No other instance of Rails cmd is running this time.
Checked Task manager but only cmd.exe is showing no else process is running. (using Windows).
TL;DR Just Run this command to Kill it
sudo kill -9 $(lsof -i :3000 -t)
Root Cause:
Because PID is locked in a file and web server thinks that if that file exists then it means it is already running. Normally when a web server is closed that file is deleted, but in some cases, proper deletion doesn't happen so you have to remove the file manually
New Solutions
when you run rails s
=> Booting WEBrick
=> Rails 4.0.4 application starting in development on http://0.0.0.0:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server
A server is already running. Check /your_project_path/tmp/pids/server.pid.
Exiting
So place your path shown here /your_project_path/tmp/pids/server.pid
and remove this server.pid file:
rm /your_project_path/tmp/pids/server.pid
OR Incase you're server was detached then follow below guidelines:
If you detached you rails server by using command "rails -d" then,
Remove rails detached server by using command
ps -aef | grep rails
OR by this command
sudo lsof -wni tcp:3000
then
kill -9 pID
OR use this command
To find and kill process by port name on which that program is running. For 3000 replace port on which your program is running.
sudo kill -9 $(lsof -i :3000 -t)
Old Solution:
rails s -p 4000 -P tmp/pids/server2.pid
Also you can find this post for more options
Rails Update to 3.2.11 breaks running multiple servers
Remove the file: C:/Sites/folder/Pids/Server.pids
Explanation
In UNIX land at least we usually track the process id (pid) in a file like server.pid. I think this is doing the same thing here. That file was probably left over from a crash.
lsof -wni tcp:3000
Then you should see the ruby process and you can run
kill -9 processid
you should be good to run the process now
rails s thin
running multiple processes doesn't seem like a good idea and from what i've read many people agree. I've noticed many memory leaks with rails unfortunately so I couldn't imagine having two processes running. I know with one overtime my page refreshes increasingly become slower because of the data being stored on memory.
kill -9 $(lsof -i tcp:3000 -t)
You can get rid of the process by killing it:
kill -9 $(lsof -i tcp:3000 -t)
$ lsof -wni tcp:3000
# Kill the running process
$ kill -9 5946
$ rm tmp/server.pids
foreman start etc start the service
gem install shutup
then go in the current folder of your rails project and run
shutup # this will kill the Rails process currently running
You can use the command 'shutup' every time you want
DICLAIMER: I am the creator of this gem
NOTE: if you are using rvm install the gem globally
rvm #global do gem install shutup
It happens when you kill your server process and the pid file was not updated.
The best solution is to delete the file Server.pid.
Use the command
rm <path to file Server.pid>
On Windows Rails 5.2, delete this file
c:/Sites/<your_folder>/tmp/pids/server.pid
and run
rails s
again.
Just open that C:/Sites/folder/Pids/Server.pids and copy that 4 digit
value.that 4 digit value is nothing but a PID, which you need to kill
to stop the already running process.
then to stop the process use below command
kill -9 <pid>
once that already running process get stopped then hit
rails s to start the rails server
Probably you suspended the server by: ^Z.
The four digital number that vim C:/Sites/folder/Pids/Server.pidsoutputs is the process id.
You should kill -9 processid, replacing the process id with the 4 numbers that vim (or other editor) outputed.
Run:
in Ubuntu/linux
sudo rm /var/www/html/rails/WBPOCTEST/tmp/pids/server.pid
Or
pkill -9 ruby
or
lsof -wni tcp:3000
kill -9 pid
If you are on Windows, you just need to do only one step as 'rails restart' and then again type
'rails s'
You are good to go.
Run: fuser -k -n tcp 3000
This will kill the process running at the default port 3000.
On Ubuntu :-
sudo kill -9 $(lsof -i :3000 -t)
where,
3000 is port number
Works for me....
For older versions :-
rails s -p 3000 -P tmp/pids/server2.pid
I just had this issue and tried setting it to a different port, but the only thing I needed to do was to delete my [app_directory]/tmp/pids/server.pid and everything was good to go.
my docker container has no lsof. Try sudo kill -9 $(netstat -ano -p tcp | grep :3000 | awk '{ print $7 }' | grep -Po '^[\d]+')
I have face this issue in my rails application when i used docker in windows mechine.
i just removed the server.pid file from the project and restart the rails application.
You just need to delete C:/Sites/folder/Pids/Server.pid this file
Just go to the TMP folder in your application.
Go to the pids folder and delete the files present. Now rerun the server. This worked for me.
I was after a way I could intuitively understand (as opposed to just memorise).
All you need to know is two things
Run the ps command to list processes, and
Run the kill command to stop a process
Example
Then it's as simple as:
ps
# PID TTY TIME CMD
# 32953 ttys000 0:00.71 -zsh
# 33730 ttys001 0:00.67 -zsh
# 46844 ttys004 0:01.78 puma 4.3.12 (tcp://localhost:3000) [myapp]
look for the PID that matches your rails server, and pass it to kill
kill -9 46844
Run ps again to see that it's now stopped.
Note
For more info on -9, run man kill.