How to run redis client with remote server? - redis-cluster

How to run redis client with remote url and how to get list of connections are stored in redis cache?
https://redis.io/commands/info

You can run redis client with remote url with following steps.
> 1. Install redis client
> 2. Open folder > C:\Program Files\Redis
> 3. Open CMD (ADMINISTRATOR)
> 4. Run Command > redis-cli.exe -h tickets-prod.6c2eqs.ng.0001.euw1.cache.amazonaws.com -p 6379 These are
> child command to get result:
> > monitor
> > multi
> > exec
> > keys *
> > Get ClientListGB
> > help
> > help #list
> > quite
> > info
info command will give full detail of redis server.
Thanks

1)You can download and install redis for Unix(here).
2) Go to command line and connect using below command:
Command: redis-cli -h <HOST> -p <PORTNO>
(You can additionaly use -a option if authentication is enabled.)
3) You would enter the redis-cli console and there you use the below commands
Command: CLIENT LIST (to display all client connected to redis with some additional info)
Command: INFO CLIENTS (to display count of client connections to redis)

Related

SSH to remote server refused if done via GitLab CI

We have a RHEL 7 remote server where I created a dummy user called gitlabci.
While SSH'd into the remote server, I generated a public-private key pair (for use when grabbing files from GitLab)
Uploaded the public key as a deploy key for use later when we get our CI set up
Generated another public-private key pair in my local machine (for use when SSH'ing into the remote server from the GitLab Runner)
Added the public key to the remote server's authorized_keys
Added the private key to the project's CI environment variables
The idea is when the CI runs, the GitLab runner will SSH into the remote server as the gitlabci user I created then fetch the branch into the web directory using the deploy keys.
I thought I have set up the keys properly but whenever the runner tries to SSH, the connection gets refused.
$ which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )
...
$ eval $(ssh-agent -s)
Agent pid 457
$ echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
Identity added: (stdin) (GitLab CI)
$ mkdir -p ~/.ssh
$ chmod 700 ~/.ssh
$ [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
$ ssh gitlabci#random.server.com
Pseudo-terminal will not be allocated because stdin is not a terminal.
ssh: connect to host random.server.com port 22: Connection refused
ERROR: Job failed: exit code 1
When I tried to SSH into the remote server via GitBash on my local machine using the key pair I generated it did work.
$ ssh -i ~/.ssh/gitlabci gitlabci#random.server.com
Last login: Mon Nov 4 13:49:59 2019 from machine01.work.server.com
ssh: connect to host random.server.com port 22: Connection refused
"Connection refused" means that the ssh client transmitted a connection request to the named host and port, and it received in response a so-called "reset" packet, indicating that the remote server was refusing to accept the connection.
If you can connect to random.server.com from one host but get connection refused from another host, a few possible explanations come to mind:
You might have an entry in your .ssh/config file which substitutes a different name or address for random.server.com. For example, an entry like the following would cause ssh to connect to random2.server.com when you request random.server.com:
Host random.server.com
Hostname random2.server.com
The IP address lookup for "random.server.com" is returning the wrong address somehow, so ssh is trying to connect to the wrong server. For example, someone might have added an entry to /etc/hosts for that hostname.
Some firewall or other packet inspection software is interfering with the connection attempt by responding with a fake reset packet.

vscode insiders connection error after update

Vscode insiders stopped to work with remote today morning after (unavoidble) update. It doesn't show remote directory, saying
Connection error: Unauthorized client refused.
and
Failed to connect to the remote extension host server (Error:
Connection error: Unauthorized client refused.)
Deletion of all remote vscode files and killing vscode processes didn't help.
The following transcript can be seen in Output tab:
remote-ssh#0.44.0
linux x64
SSH Resolver called for "ssh-remote+myserver", attempt 1
SSH Resolver called for host: myserver
Setting up SSH remote "myserver"
Using commit id "MYHASH" and quality "insider" for server
Testing ssh with ssh -V
ssh exited with code: 0
Got stderr from ssh: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
Install and start server if needed
> Found existing installation at /home/dimskraft/.vscode-server-insiders/bin/MYHASH...
> Found running server...
>
> *
> * Reminder: You may only use this software with Visual Studio family products,
> * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
> *
>
> Checking server status with wget
> ==MY-GUID==
"install" terminal command done
Received install output: ==MY-GUID==
Server is listening on port 35693
Spawning tunnel with: "ssh" -L 127.0.0.1:35693:127.0.0.1:35693 -o ConnectTimeout=15 "myserver" bash << 'EOSSH'
echo -e 'Connected to SSH Host - Please do not close this terminal' && sleep infinity
EOSSH
> Connected to SSH Host - Please do not close this terminal
Spawned SSH tunnel between local port 35693 and remote port 35693
Waiting for ssh tunnel to be ready
Tunneling remote port 35693 to local port 35693
Resolved "ssh-remote+myserver" to "127.0.0.1:35693"
------
Downgrading to 1.36.0-insider helped

Varnish configured, socket(): Address family not supported by protocol

I am working on Centos 6.8 with Apache 2.4 and I had no trouble installing varnish and configured everything correctly for my Magento 2 site.
I have installed a SLL Certificate so I added the -p feature=+esi_ignore_https to my sysconfig file.
everything looks good at first
> service varnish restart
> Stopping Varnish Cache: [ OK ]
> Starting Varnish Cache: [ OK ]
Then when I Start the Varnish CLI with
> varnishd -d -f /etc/varnish/default.vcl
>
> Type 'help' for command list.
> Type 'quit' to close CLI session.
> Type 'start' to launch worker process.
>
> **socket(): Address family not supported by protocol**
and when I enter start I get an endless Loop of this
Child cleanup complete
socket(): Address family not supported by protocol
child (30530) Started
Child (30530) said Child starts
Child (30530) died signal=6
Child (30530) Panic message:
Assert error in vca_acct(), cache/cache_acceptor.c line 386:
Condition((listen(ls->sock, cache_param->listen_depth)) == 0) not true.
errno = 98 (Address already in use)
thread = (cache-acceptor)
version = varnish-4.0.4 revision 386f712
ident = Linux,2.6.32-042stab113.11,x86_64,-smalloc,-smalloc,-hcritbit,epoll
Backtrace:
0x432425: varnishd() [0x432425]
0x40d71d: varnishd() [0x40d71d]
0x7f105722aaa1: /lib64/libpthread.so.0(+0x7aa1) [0x7f105722aaa1]
0x7f1056f77bcd: /lib64/libc.so.6(clone+0x6d) [0x7f1056f77bcd]
Also when try I to log into varnishlog
Can't open VSM file (Abandoned VSM file (Varnish not running?)
/var/lib/varnish/patriciasouths.com/_.vsm )
service varnish start
Starting Varnish Cache: Error: Cannot open socket: :6081: Address family not supported by protocol
So this is really dumb.. the default install is this..
DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
-f ${VARNISH_VCL_CONF} \
-T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
-p thread_pool_min=${VARNISH_MIN_THREADS} \
-p thread_pool_max=${VARNISH_MAX_THREADS} \
-S ${VARNISH_SECRET_FILE} \
-s ${VARNISH_STORAGE}"
Here we have a variable to use ${VARNISH_LISTEN_ADDRESS}... but its NOT DEFINED PREVIOUSLY!
# Telnet admin interface listen address and port
VARNISH_ADMIN_LISTEN_PORT=6082
DOH! So add it.
# Telnet admin interface listen address and port
VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
VARNISH_ADMIN_LISTEN_PORT=6082
Starting Varnish Cache: [ OK ]
varnish.x86_64 0:4.1.10-1.el6 FAIL from https://packagecloud.io/varnishcache/varnish41/el/6/SRPMS

Docker Redis CLI Timeout

I have a Redis Service running inside a docker container but when connecting to it the cursor is not returned.
When using redis-cli the terminal just hangs with issuing commands, I hope someone can point out where I'm going wrong.
Instead of seeing regular redis-cli output like:
% redis-cli
redis 127.0.0.1:6379> set docker awesome
OK
redis 127.0.0.1:6379> get docker
"awesome"
redis 127.0.0.1:6379>
This is what I am seeing:
% redis-cli -p 49156
redis 127.0.0.1:49156> set docker awesome
There's no "OK" and the terminal just hangs until I Ctrl-C it.
I'm following the docker.io instructions from http://docs.docker.io/en/latest/examples/running_redis_service/
Here's my Dockerfile:
FROM ubuntu:12.10
RUN apt-get update
RUN apt-get -y install redis-server
EXPOSE 6379
ENTRYPOINT ["/usr/bin/redis-server"]
I build the image with:
sudo docker build -t rudijs/redis .
I run an instance of the image with:
sudo docker run -d -p 6379 -name redis rudijs/redis
% sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3888fa49b605 rudijs/redis:latest /usr/bin/redis-serve 5 seconds ago Up 4 seconds 0.0.0.0:49156->6379/tcp redis
The exposed container redis port is at:
% sudo docker port redis 6379
0.0.0.0:49156
% redis-cli -p 49156
redis 127.0.0.1:49156> set docker awesome
I've tried tinkering with different port bindings from the container to the host but the result is always the same - cli hang.
Issuing command like "help" seem to work fine
% redis-cli -p 49156
redis 127.0.0.1:49156> help
redis-cli 2.2.12
Type: "help #<group>" to get a list of commands in <group>
"help <command>" for help on <command>
"help <tab>" to get a list of possible help topics
"quit" to exit
redis 127.0.0.1:49156>
If I just let it sit I get a timeout:
% redis-cli -p 49156
redis 127.0.0.1:49156> set docker awesome
Error: Connection reset by peer
(248.52s)
redis 127.0.0.1:49156>
Any advice or tips with this problem much appreciated.
Thanks!
The fix for this was Firehol (iptables) rules were needed:
interface docker0 interface1 src "172.17.0.0/16" dst 172.17.42.1
server all accept
client all accept

How to exit prompt when starting a weblogic administration server remotely?

I am trying to start Weblogic Admin server using start-up script (./startWeblogic.sh) from a remote host using a different user. The server starts fine but prompt is stuck, it does not return
Background: We have multiple admin servers in different environment and the requirement is all has to be started/stopped from a central automation server which has a password less sudo connectivity to all Weblogic hosts.
I am using command :
{ssh -l user remote-address '/spare/app/oracle/product/Middleware/user_projects/domains/example_domain/bin/./startWebLogenter code hereic.sh & > /dev/null < /dev/null'}
As admin server is spawning a child shell, the parent shell is not closing and it keeps holding the prompt.
Please Advise.
Thanks,
Bhaskar
A common approach is to use the nohup command. Try this:
ssh -l user remote-address '/usr/bin/nohup /spare/app/oracle/product/Middleware/user_projects/domains/example_domain/bin/./startWebLogic.sh & > /dev/null < /dev/null'