Solana WebSocket URL Port doesn't shown on netstat - websocket

I'd like to add WebSocket URL as:
http://0.0.0.0:8900
So I typed solana config get to get the location of config.yaml file. Then changed the WebSocket URL as followed above, however, after restarting the node and the server http://0.0.0.0:8900 is not listed on netstat -tulpn . Do I have to do anything else or my node is unable to recognize the comfig.yaml file? Or do I have to pass additional parameter while starting the node? Any help appreciated thanks in advance.
Result of solana config get:
Config File: /home/centos/.config/solana/cli/config.yml
RPC URL: http://api.devnet.solana.com
WebSocket URL: http://0.0.0.0:8900
Keypair Path: /home/centos/solana/validator-keypair.json
Commitment: confirmed
It changes the WebSocket URL after I modify the config.yaml file but doesn't listed in netstat.

solana config get only shows the client configuration, and not the node / validator configuration.
If you're using either solana-validator or solana-test-validator, you can set the rpc-port at the command line, and the websocket port will be right after:
$ solana-test-validator --rpc-port 10001
and somewhere else, you can see:
$ ss -l
<... truncated ...>
tcp LISTEN 0 1024 0.0.0.0:10001 0.0.0.0:*
tcp LISTEN 0 1024 0.0.0.0:10002 0.0.0.0:*
So the websocket port is 10002.
To have the client connect to this validator, you can do:
solana config set -u http://localhost:10001

This is how I started the node:
solana-validator \
--ledger /home/centos/solana/data/ \
--identity /home/centos/solana/validator-keypair.json \
--entrypoint entrypoint.mainnet-beta.solana.com:8001 \
--expected-genesis-hash 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d \
--rpc-port 8899 \
--dynamic-port-range 8000-8020 \
--no-voting \
--enable-rpc-transaction-history \
--limit-ledger-size \
--known-validator 7Np41oeYqPefeNQEHSv1UDhYrehxin3NStELsSKCT4K2 \
--known-validator GdnSyH3YtwcxFvQrVVJMm1JhTS4QVX7MFsX56uJLUfiZ \
--known-validator DE1bawNcRJB9rVm3buyMVfr8mBEoyyu73NBovf2oXJsJ \
--known-validator CakcnaRDHka2gXyfbEd2d3xsvkJkqsLw2akB3zsN1D2S \
--only-known-rpc \
--no-port-check \
--full-rpc-api
I did pass the port as 8899, so by default WS port should be 8900 right? I also changed the config.yml file to make it 0.0.0.0 in order to connect outside of the node. It's visible in netstat ports but I can connect to 8900 only locally.
Config File: /home/centos/.config/solana/cli/config.yml
RPC URL: http://0.0.0.0:8899
WebSocket URL: ws://0.0.0.0:8900
Keypair Path: /home/centos/validator-keypair.json
Commitment: confirmed

Related

how to access docker mariadb container from outside?

I followed the official guide at:
https://mariadb.com/kb/en/installing-and-using-mariadb-via-docker/
However, I haven't found any entry with bind-address in my my.cnf file, it looks like this:
# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read.
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# If you are new to MariaDB, check out https://mariadb.com/kb/en/basic-mariadb-articles/
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
# Port or socket location where to connect
# port = 3306
socket = /run/mysqld/mysqld.sock
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
when I try to connect to it from outside, that is from the host computer, I get the following:
Creating a session to 'root#172.17.0.2'
MySQL Error 2003 (HY000): Can't connect to MySQL server on '172.17.0.2' (60)
What should I do to be able to connect to the server from outside? It does run as I can connect from within the docker container.
I'm using macOS.
You can't do this trick mysql -h 172.17.0.2 -u root -p on Mac.
There is no docker0 bridge on macOS🔗
Because of the way networking is implemented in Docker Desktop for Mac, you cannot see a docker0 interface on the host. This interface is actually within the virtual machine.
I cannot ping my containers
Docker Desktop for Mac can’t route traffic to containers.
Please see the official docker documentation for Mac.
I suggest you expose the container port to the host -p 127.0.0.1:3306:3306 and then connect to your DB as to the localhost mysql -h 127.0.0.1 -p -uroot.
docker run --name mariadbtest \
-p 127.0.0.1:3306:3306\
-e MYSQL_ROOT_PASSWORD=mypass \
-d mariadb/server:10.3 \
--log-bin \
--binlog-format=MIXED
Your configuration uses a socket for connections, as you have commented out port:
# port = 3306
socket = /run/mysqld/mysqld.sock
So you should uncomment port above (and remove / comment out the socket configuration). This will cause the database to listen on port 3306.
For local usage you'll want to port-map that port to localhost afterward, for example running your container with -p so you can connect via localhost:3306:
docker -d -p 127.0.0.1:3306:3306 [..] example/mariadb

Access jboss 8080 port inside docker container

I'm running jboss5 in centos6.7 docker contrainer.
JBoss running using run.sh -b 0.0.0.0 command
Container running using docker run -i -t -p 8080:8080 my/jboss /bin/bash
This is what I see in container
[root#e44f2bbab31a bin]# netstat -alnt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN
This is what I see on host
15:04:17:(~)$ sudo docker ps
[sudo] password for c0rp:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e44f2bbab31a my/jboss "/bin/bash" 4 hours ago Up 4 hours 0.0.0.0:8080->8080/tcp thirsty_franklin
When I'm trying to access jboss application from host by localhost:8080 I see ERROR 404: Not Found.
When I'm checking localhost:8080 from inside container using wget I see same error ERROR 404: Not Found.
Everything is ok if I'm using ip address of container. Question is how can I bind host localhost:8080 to container ip_address:8080 ?
localhost is a alias for 127.0.0.1. This address used for loopback. It means what your request will returned to the same machine on Network OSI model layer(through lo0 interface in ifconfig command). But you can get access to your container using request to localhost:
!!!Very-very dirty hack!!! Don't use it. Just for understanding of localhost issue. You can edit hosts file (example for Mac):
sudo nano /private/etc/hosts
You will see something like this:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Just replace 127.0.0.1 by ip of your container. I'm repeating: it's just for understanding of localhost
You can run NGINX instance on your localhost machine. You can configure it for sending all requests from localhost:8080 to containerIp:8080 (best variant without any configuration with routing)
I found that running
FROM registry.access.redhat.com/jboss-eap-7/eap71-openshift
that I also needed to open the management port, so you (or rather, someone in the future coming across this thread) should try this:
docker run -dit -p 8080:8080 -p 9990:9990 [image name]

I can't connect to mysqlfabric

I can't connect to mysqlfabric on port 32275.
I am connecting on port 3306 to database so all the grants are in place . On port 32275 I get a message
ERROR 1044 (42000): [Fabric] Access denied
for user and in log I can see
[INFO] 1441810699.948011 - MySQL-RPC-Session-4 - User 'john'
denied access which suggests permissions issue.
I can log in to database if I use
mysql -u fabric -p -h localhost -P 32275
but if I use
mysql -u fabric -p -h host-ip-address -P 32275
I get above error. I can see in netstat that server is listening on that port.
What am I doing wrong ?
There are a couple of things to check in the fabric config.
Firstly try disabling RPC authenication until you have it up and running.
[protocol.xmlrpc]
disable_authentication = no
Also check your storage section and test you can connect using these settings.
[storage]
address = 192.168.0.1:3306
user = fabric_store
password = secret
database = mysql_fabric
auth_plugin = mysql_native_password
mysql -u fabric -psecret -h 192.168.0.1 -P 3306 fabric_store

how to send traffic from mitmproxy to another proxy server

I have a need to redirect mitmproxy to another proxy server. Let say an example.
Browser -> mitmproxy -> fiddler
Browser proxy was set to 8089
mitmproxy is running on 8089
fiddler listening on 8090
now how can i do proxy forward mitmproxy using -F
i tried mitmproxy -p 8089 -F localhost:8090, but the output was unrecognised argument -F
Any help ?
Thanks
You can specify an upstream proxy using -U (which was previously called -F).
-U is deprecated now. You shall use --mode upstream:SPEC
mitmproxy --mode upstream:http://<target-proxy-ip>:<target-proxy-port> --upstream-auth <target-proxy-user-name>:<target-proxy-password> -p 3128 --set block_global=false
Reference: https://docs.mitmproxy.org/stable/concepts-modes/#upstream-proxy
Example (allows outside connection):
Server-1 (ip: x.x.x.x)
mitmproxy --proxyauth "user1:pass1" -p 3128 --set block_global=false
Server-2 (ip: y.y.y.y)
mitmproxy --mode upstream:http://x.x.x.x:3128 --upstream-auth user1:pass1 -p 3128 --set block_global=false
Client
Proxy: y.y.y.y:3128

Connection is not being established

I have two running container for flume and hadoop. Let it be hadoop2 and flume2. I created these two containers from two images namely hadoop_alone and flume_alone.
docker run -d -p 10.236.173.XX:8020:8020 -p 10.236.173.XX:50030:50030 -p 10.236.173.XX:50060:50060 -p 10.236.173.XX:50070:50070 -p 10.236.173.XX:50075:50075 -p 10.236.173.XX:50090:50090 -p 10.236.173.XX:50105:50105 --name hadoopservices hadoop_alone
I get into hadoop container and checked for exposed ports. So All the ports are exposed properly.
docker run -d --name flumeservices -p 0.0.0.0:5140:5140 -p 0.0.0.0:44444:44444 --link hadoopservices:hadoopservices flume_alone
I get into flume container and checked for env and etc/hosts entries. There is an entry for hadoopservices and env variables are created automatically.
My core-site.xml
fs.defaultFS
hdfs://0.0.0.0:8020
I modified it so it ll accept services at 8020 from all the containers.
My source and sink in flume.conf
a2.sources.r1.type = netcat
a2.sources.r1.bind = localhost
a2.sources.r1.port = 5140
a2.sinks.k1.type = hdfs
a2.sinks.k1.hdfs.fileType = DataStream
a2.sinks.k1.hdfs.writeFormat = Text
a2.sinks.k1.hdfs.path = hdfs://hadoopservices:8020/user/root/syslog/%y-%m-%d/%H%M/%S
a2.sinks.k1.hdfs.filePrefix = events
a2.sinks.k1.hdfs.roundUnit = minute
a2.sinks.k1.hdfs.useLocalTimeStamp = true
I restarted hadoop namenode after changing core-site.xml.
I try to write into hdfs from flume using
/usr/bin/flume-ng agent --conf-file /etc/flume-ng/conf/flume.conf --name a2 -Dflume.root.logger=INFO,console
It says
INFO hdfs.DFSClient: Exception in createBlockOutputStream
java.net.ConnectException: Connection refused
So i found something is the problem with connection established between these two contianers. I get into hadoop container and checked for port connections
netstat -tna
tcp 0 0 127.0.0.1:52521 127.0.0.1:8020 TIME_WAIT
tcp 0 0 127.0.0.1:8020 127.0.0.1:52516 ESTABLISHED
tcp 0 0 127.0.0.1:52516 127.0.0.1:8020 ESTABLISHED
But i expect it to be
tcp 0 0 172.17.1.XX:54342 172.17.1.XX:8020 TIME_WAIT
tcp 0 0 172.17.1.XX:54332 172.17.1.XX:8020 ESTABLISHED
tcp 0 0 172.17.1.XX:8020 172.17.1.XX:54332 ESTABLISHED
Where 172.17.1.XX is the ip of my hadoop container.
I found the cause. Is it the reason?
Which configuration should be modified? And or my run statement? What should be changed to establish connection between these two docker containers so that i can able to write into hdfs from flume.
If you need more info, i 'll edit it further.
Please tell me some ideas.
If anybody face the same problem, please do the following steps.
1) Check whether 0.0.0.0:8020 is updated in core-site.xml
2) If you update it inside running container, **I suggest you all to restart ALL the services NOT ONLY namenode**. [better do as part of Dockerfile]
3) Check for `env` and `etc/hosts` contents in flume container
4) And hostname in `etc/hosts` must be matched with the `hdfs path` parameter in flume.conf
5) Get into hadoop container and do `netstat -tna` and you must see connection established to <hadoop_container_ip>:8020. Not to your localhost[127.0.0.1].
I hope it 'll be helpful to the people who tries to link containers and port mapping.

Resources