I am new to Redis.I have installed it from github repo.Now when I try
redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>
With
ps aux | grep redis
milenko 14834 0.0 0.0 15444 980 pts/1 S+ 11:14 0:00 grep --color=auto redis
As you can see in your ps result, redis is not started yet (only the grep process is found).
You may want to start the service with a redis-server command.
Take a look at the documentation: https://redis.io/topics/quickstart#starting-redis
Related
Installed a redis in ubuntu 16.4 in digitalocean.
I've changed the default redis server 127.0.0.1:6379 into my own ip in digitalocean 178.xxx.xxx.xxx:6379 by editing editing vim /etc/redis/redis.conf
After that I tried redis-cli and redis-cli shutdown all responded this:
Could not connect to Redis at 127.0.0.1:6379: Connection refused
But if ps aux|grep redis
I get:
redis 11734 0.0 0.1 41852 3892 ? Ssl 15:45 0:11 /usr/local/bin/redis-server 178.xxx.xxx.xxx:6379
root 12735 0.0 0.0 12944 948 pts/0 S+ 19:11 0:00 grep --color=auto redis
Is this normal?Or what should I do?
What you should do depends on how you want it to work...
If you want to be able to connect to Redis via any network interface, comment out all the bind directives in your config file by putting a # at the start of the line beginning bind.
If you want to only be able to connect by specifying 178.xxx.xxx.xxx, then put the following in your config file:
bind 178.xxx.xxx.xxx
If you want to use 127.0.0.1 or 178.xxx.xxx.xxx, then put:
bind 178.xxx.xxx.xxx 127.0.0.1
I'm guessing you want this option, but see security note below.
In general though, it is not advisable from a security point of view, to expose your Redis server to the whole Internet - and all the options above do exactly that. You probably want to bind to 127.0.0.1 and set up an ssh tunnel from your 178.xxx.xxx.xxx public address to 127.0.0.1.
Whatever you put in there, restart Redis to make changes take effect.
I am playing around Google Cloud Platform and Redis. But is is way more complicated than I expect.
I want to shutdown redis-server, in my local version i can just:
redis-cli shutdown
redis-cli ping // Could not connect to Redis at 127.0.0.1:6379: Connection refused
that means the redis-server no longer running.
But I cannot do that in GCP. I still can get PONG after the refis-cli shutdown.
I googled around and somebody suggest kill.
first find out what is the PID of the redis-server
ps -f -u redis
I will get:
which 1637 is the PID. so I do:
sudo kill 1637
and try refis-cli ping again, I still get PONG.
I tried ps -f -u redis again. I get:
It seems like for every kill, it will respawn it self with other PID.
How can I resolve this?
The redis-cli shutdown works on Mac OS. If you using Debian or Ubuntu, the easiest, way you can shutdown the server is to go into the server and type sudo service redis-server stop and service redis-server start to start it again.
Example
test-user#my-server:~$ sudo service redis-server stop
test-user#my-server:~$ ps -f -u redis
UID PID PPID C STIME TTY TIME CMD
test-user#my-server:~$
The question was answered in this community post. You may also see the following community tutorial on "How to Set Up Redis on Google Compute Engine"
I use brew to install httpd, I stopped the service using brew services stop httpd then I visit locahost, I still can see apache is running?
You need to give following command: service httpd stop
You must kill the processes. As I can see from your comment you are running httpd as the users www and root:
_www 3356 0.0 0.0 2455088 704 ?? S 9:25AM 0:00.00 /usr/sbin/httpd -D FOREGROUND
root 3355 0.0 0.0 2455344 3588 ?? Ss 9:25AM 0:00.14 /usr/sbin/httpd -D FOREGROUND
private.laptop 3967 0.0 0.0 2444068 816 s004 S+ 9:46AM 0:00.00 grep httpd
The first column represent the user and the second column the process ID or PID.
Try running:
sudo kill -9 3356
sudo kill -9 3355
After each execution verify the services dissapear using ps aux | grep httpd
The last proccess private.laptop isn't related to your problem so no need to kill it.
If your problem isn't solved by this, maybe a daemon is executing your httpd, please refeer to this.
I try to restart the apache service on ubuntu 16.04 but i can not because the port '80' is listened to by nginx.
But when I try to stop nginx, the service is not found.
netstat -ltnp | grep ':80'
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6069/nginx
systemctl status nginx
● nginx.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
service nginx stop
Failed to stop nginx.service: Unit nginx.service not loaded.
So how can I stop nginx in order to restart apache ?
Thanks for your help
nginx on your machine was started in other way then systemd standard nginx service.
alex#openresty:~$ ps aux | grep nginx
root 2668 0.0 0.0 41040 928 ? Ss 12:33 0:00 nginx: master process /usr/local/openresty/bin/openresty -p /usr/local/openresty/nginx/
nobody 2669 0.0 0.0 41040 3316 ? S 12:33 0:00 nginx: worker process
Will show you the full path of running nginx with command line arguments. Here is example from my PC (I use Openresty bundle so your paths may vary).
Now take a look at nginx master process command line parameters. If -p is present you should use exactly the same to stop nginx. For my case it should be:
/usr/local/openresty/bin/openresty -p /usr/local/openresty/nginx/ -s stop
If -p is missed you may just
/usr/local/openresty/bin/openresty -s stop
It would stop nginx, but it may be possible that on your PC nginx is configured to run as not standard service, for example hand written systemd unit.
So on every reboot you will have nginx running again.
Our EC2 instance has been experiencing very slow connection lately.
After we investigate deeper, we found out that there are few hundred ssh processes running, and they are all trying to connect to the same host (i.e it's almost like ddos attack against that host).
ps aux | grep ssh
root 971 0.0 0.0 61364 3084 ? Ss Dec11 0:00 /usr/sbin/sshd -D
root 7649 0.0 0.0 105628 4228 ? Ss 03:57 0:00 sshd: ubuntu [priv]
ubuntu 7811 0.0 0.0 106404 2740 ? S 03:57 0:00 sshd: ubuntu#pts/0
ubuntu 8616 0.0 0.0 44012 2516 pts/2 S 04:02 0:00 ssh deploy#xxx.xxx.xxx.xxx
ubuntu 8618 0.0 0.0 44012 2512 pts/2 S 04:02 0:00 ssh deploy#xxx.xxx.xxx.xxx
ubuntu 8620 0.0 0.0 44012 2512 pts/2 S 04:02 0:00 ssh deploy#xxx.xxx.xxx.xxx
ubuntu 8622 0.0 0.0 44012 2512 pts/2 S 04:02 0:00 ssh deploy#xxx.xxx.xxx.xxx
ubuntu 8624 0.0 0.0 44012 2516 pts/2 S 04:02 0:00 ssh deploy#xxx.xxx.xxx.xxx
...
Here I logged in as ubuntu. I vaguely remember I executed the command a while ago trying to connect to the host, but ssh outputs many instances of itself and the terminal got frozen, and since then we have been experiencing the slow connection issue.
Anyhow, I tried to kill all of the ssh processes, but they just keep coming back and eventually slow down the whole system connection again.
$ killall -9 ssh
Any idea what went wrong and how can I solve this problem?