i have installed mysql on ubuntu server, but i want to connect with mysql workbench remotely.
I just see other answer, but my /etc/mysql/my.cnf is that:
GNU nano 2.5.3 File: /etc/mysql/my.cnf Modified
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
I just Grant privileges to 'root'#'%'
This is netstat:
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 16431/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1471/sshd
tcp6 0 0 :::80 :::* LISTEN 15874/apache2
tcp6 0 0 :::22 :::* LISTEN 1471/sshd
What can i do? Any ideas of bad configuration?
Related
I'm trying to build an OKD 4.5 single node cluster following Craig Robinson blog post (at https://medium.com/swlh/guide-okd-4-5-single-node-cluster-832693cb752b). I faced with this issue first on bootstrap node, but after deleting and recreating the whole process again, it booted up successfully. But the same issue happened again while preparing control plane master node. After initial coreos download (which proves webserver is working fine), I get this recurring GET error message over and over again:
ignition[xxx]: GET error: Get "https://api-int.lab.okd.local:22623/config/master": EOF
And this is my control plane node config:
ip=10.106.31.233::10.106.31.1:255.255.255.0:::none nameserver=10.106.31.231 coreos.inst.install_dev=/dev/sda coreos.inst.image_url=http://10.106.31.231:8080/okd4/ fcos.raw.xz coreos.inst.ignition_url=http://10.106.31.231:8080/okd4/master.ign
IPs are:
okd-services: 10.106.31.231 ;
bootstrap: 10.106.31.232 ;
control-plane: 10.106.31.233
I can reach the http://10.106.31.231:8080/okd4 address from remote pc and list the contents including master.ign file. Also pinging "api-int.lab.okd.local" is successful too. firewalld open ports on okd-services node are:
[root#okd4-services ~]# ss -ltu
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 0.0.0.0:hostmon 0.0.0.0:*
udp UNCONN 0 0 10.106.31.231:domain 0.0.0.0:*
udp UNCONN 0 0 127.0.0.1:domain 0.0.0.0:*
udp UNCONN 0 0 127.0.0.53%lo:domain 0.0.0.0:*
udp UNCONN 0 0 [::]:hostmon [::]:*
udp UNCONN 0 0 [::]:domain [::]:*
tcp LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.1:rndc 0.0.0.0:*
tcp LISTEN 0 4096 0.0.0.0:https 0.0.0.0:*
tcp LISTEN 0 4096 0.0.0.0:22623 0.0.0.0:*
tcp LISTEN 0 4096 0.0.0.0:cslistener 0.0.0.0:*
tcp LISTEN 0 4096 0.0.0.0:sun-sr-https 0.0.0.0:*
tcp LISTEN 0 4096 0.0.0.0:hostmon 0.0.0.0:*
tcp LISTEN 0 4096 0.0.0.0:http 0.0.0.0:*
tcp LISTEN 0 10 10.106.31.231:domain 0.0.0.0:*
tcp LISTEN 0 10 127.0.0.1:domain 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.53%lo:domain 0.0.0.0:*
tcp LISTEN 0 128 [::]:ssh [::]:*
tcp LISTEN 0 4096 [::1]:rndc [::]:*
tcp LISTEN 0 4096 [::]:hostmon [::]:*
tcp LISTEN 0 511 *:webcache *:*
tcp LISTEN 0 10 [::]:domain [::]:*
the output of the dig test on okd-services node is:
[root#okd4-services ~]# dig -x 10.106.31.231
; <<>> DiG 9.11.25-RedHat-9.11.25-2.fc33 <<>> -x 10.106.31.231
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60620
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;231.31.106.10.in-addr.arpa. IN PTR
;; ANSWER SECTION:
231.31.106.10.in-addr.arpa. 604800 IN PTR api-int.lab.okd.local.
231.31.106.10.in-addr.arpa. 604800 IN PTR api.lab.okd.local.
231.31.106.10.in-addr.arpa. 604800 IN PTR okd4-services.okd.local.
;; SERVER: 127.0.0.53#53(127.0.0.53)
I deleted and recreated the control plane to see if it solved the issue, but was not successful. Any idea what this issue means?
I had exact the same issue with this article. The problem was with bootstrap node that cannot finish initialization process. First of all initialize bootstrap node and sure that the process was finished. The simplest way to check what's going on with a node:
Connect to a node with ssh core#<NODE'S-IP> from the machine where you generate ssh-certificate
ssh will provide you useful information:
This is the bootstrap node; it will be destroyed when the master is
fully up.
The primary services are release-image.service followed by
bootkube.service. To watch their status, run e.g.
journalctl -b -f -u release-image.service -u bootkube.service This
is the bootstrap node; it will be destroyed when the master is fully
up.
The primary services are release-image.service followed by
bootkube.service. To watch their status, run e.g.
journalctl -b -f -u release-image.service -u bootkube.service Fedora
CoreOS 32.20200629.3.0 Tracker:
https://github.com/coreos/fedora-coreos-tracker Discuss:
https://discussion.fedoraproject.org/c/server/coreos/
First of all you have to check journalctl -b -f -u release-image.service -u bootkube.service because it's main units. However, there're might be other issues so check failed/not finished systemd's service units with systemctl list-units --type=service and journalctl -f -u <UNIT-NAME> to follow the process
Whole process will spend some time (~20-40 mins in my case) and there're might be some timeouts in journal's logs so just wait the final status of the unit.
Only then you can start initializing of control-plane node
Finally, my issue was in wrong fedora-core-os version because you can use 32 version only. For me it's installed okay with:
fedora-coreos-32.20201104.3.0-metal.x86_64.raw.xz
fedora-coreos-32.20201104.3.0-metal.x86_64.raw.xz.sig
fedora-coreos-32.20201104.3.0-live.x86_64.iso
openshift-client-linux-4.5.0-0.okd-2020-10-15-235428.tar.gz
openshift-install-linux-4.5.0-0.okd-2020-10-15-235428.tar.gz
I am facing errors at the first cup of Ejabberd.
On my Mac(10.13.6) I installed "ejabberd-18.12.1-osx.app" and I have followed all instruction written in official website. (https://docs.ejabberd.im/admin/installation/#install-on-macos)
After installation was completed I noticed nothing significant and found error logs were generated as below.
2019-01-16 10:02:03.936 [error] <0.316.0>#ejabberd_listener:report_socket_error:417 Failed to open socket at [::]:5222 for ejabberd_c2s: address already in use
2019-01-16 10:02:03.937 [error] <0.315.0> Supervisor ejabberd_listener had child {5222,{0,0,0,0,0,0,0,0},tcp} started with ejabberd_listener:start({5222,{0,0,0,0,0,0,0,0},tcp}, ejabberd_c2s, [{ip,{0,0,0,0,0,0,0,0}},{max_stanza_size,262144},{shaper,c2s_shaper},{access,c2s},{starttls_required,...}]) at undefined exit with reason eaddrinuse in context start_error
2019-01-16 10:02:03.937 [error] <0.274.0> Supervisor ejabberd_sup had child ejabberd_listener started with ejabberd_listener:start_link() at undefined exit with reason {shutdown,{failed_to_start_child,{5222,{0,0,0,0,0,0,0,0},tcp},eaddrinuse}} in context start_error
2019-01-16 10:02:03.942 [critical] <0.81.0>#ejabberd_app:start:66 Failed to start ejabberd application: {error,{shutdown,{failed_to_start_child,ejabberd_listener,{shutdown,{failed_to_start_child,{5222,{0,0,0,0,0,0,0,0},tcp},eaddrinuse}}}}}
I exactly understand what "address already in use" means but netstat does not show any possession on this port. Also I never changed any of the server configuration. I tried to start server manually but same errors repeats.
Does this version of Ejabberd have bugs on Mac installation?
Many thanks in advance.
When ejabberd starts, it uses several ports (some for XMPP, others for additional ejabberd features, others for Erlang). Notice that some ports may be in IPv6:
tcp 0 0 0.0.0.0:42859 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4560 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:epmd 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5280 0.0.0.0:* LISTEN
tcp6 0 0 [::]:epmd [::]:* LISTEN
tcp6 0 0 [::]:xmpp-client [::]:* LISTEN
tcp6 0 0 [::]:xmpp-server [::]:* LISTEN
Maybe you have other previous ejabberd installation around there messing? Or other XMPP server?
Hello I've an issue on MySQL I can't connect to it remotely, I already looked for the answers posted here but none of them works for me!
This is the Error Message when I trying to connect to mysql
$> mysql -u user01 -h x.x.x.x -p
ERROR 2003 (HY000): Can't connect to MySQL server on 'x.x.x.x' (110)
Telnet
[root#machine2 ~]# telnet x.x.x.x 3306
Trying x.x.x.x...
telnet: connect to address x.x.x.x: Connection timed out
This the IPTABLES file
#Generated by iptables-save v1.4.7 on Thu Jan 4 21:58:18 2018
*filter
:INPUT ACCEPT [56:6256]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [35:3538]
-A INPUT -p tcp -m tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
-A INPUT -i lo -p tcp -m tcp --dport 3306 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT
COMMIT
#Completed on Thu Jan 4 21:58:18 2018
-- I already create a user
CREATE USER 'user' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON *.* TO 'user';
FLUSH PRIVILEGES;
and this is my.cnf file
#For advice on how to change settings please see
#http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
port=3306
skip-name-resolve
skip-external-locking
innodb_buffer_pool_size=3G
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
and My port 3306 is already open
[root#localhost ~]# netstat -petulan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 0 12889 2056/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 13930 2441/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 0 13141 2133/cupsd
tcp 0 0 0.0.0.0:32895 0.0.0.0:* LISTEN 29 12977 2078/rpc.statd
tcp 0 0 x.x.x.x:22 x.x.x.x:49964 ESTABLISHED 0 7891927 4453/sshd
tcp 0 64 x.x.x.x:22 x.x.x.x:50203 ESTABLISHED 0 7892871 4482/sshd
tcp 0 0 :::3306 :::* LISTEN 27 7896831 6648/mysqld
tcp 0 0 :::111 :::* LISTEN 0 12892 2056/rpcbind
Is there something here wrong ?, thank you !
I'm using CentOS 6.9
I am trying to connect to Server A (Ubuntu 16.04) remotely from Server B (Ubuntu 16.04). I can already use MySQL fine with remote#[Server A IP] on Server A, but I am having trouble accessing that user from Server B. I have gone through the procedure of checking ufw firewalls, configuration files, and the MySQL user, but I cannot seem to find what the issue is. What are possible steps I can go through to provide more information, or is the issue in some information I provided?
Server A with database
Configuration Files
/etc/mysql/my.cnf
# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 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.
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4
/etc/mysql/mariadb.cnf
# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 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.
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4
/etc/mysql/mariadb.conf.d/50-server.cnf
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# Bind to all addresses
# bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit = 1000
#log_slow_verbosity = query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
# This group is only read by MariaDB-10.0 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.0]
Results from Commands
$ netstat -nat |grep :3306
tcp6 0 0 :::3306 :::* LISTEN
tcp6 0 0 127.0.0.1:54160 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:53974 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:42564 ESTABLISHED
tcp6 0 0 127.0.0.1:42566 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:49010 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:39372 ESTABLISHED
tcp6 0 0 127.0.0.1:54104 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:42576 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:49178 127.0.0.1:3306 TIME_WAIT
tcp6 0 0 127.0.0.1:3306 127.0.0.1:39326 ESTABLISHED
tcp6 0 0 127.0.0.1:39266 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:53976 ESTABLISHED
tcp6 0 0 127.0.0.1:49142 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:49494 ESTABLISHED
tcp6 0 0 127.0.0.1:42590 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:54104 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:39264 ESTABLISHED
tcp6 0 0 127.0.0.1:49434 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:49216 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:49010 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:39372 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:49142 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:42590 ESTABLISHED
tcp6 0 0 127.0.0.1:54162 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:54106 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:49494 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:42576 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:49434 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:54160 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:53974 ESTABLISHED
tcp6 0 0 127.0.0.1:39264 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:42566 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:49216 ESTABLISHED
tcp6 0 0 127.0.0.1:39326 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:54162 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:39266 ESTABLISHED
tcp6 0 0 127.0.0.1:42564 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:53976 127.0.0.1:3306 ESTABLISHED
tcp6 0 0 127.0.0.1:3306 127.0.0.1:54106 ESTABLISHED
Also
MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
+--------+---------------+
| User | Host |
+--------+---------------+
| remote | [ Server A IP ] |
+--------+---------------+
and
ufw status | grep 3306
3306 ALLOW [ Server B IP ]
Server B trying to connect to Server A
$ mysql -u remote -h [ Server A IP ] -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '[ Server A IP ]' (111 "Connection refused")
also
ufw status | grep 3306
3306 ALLOW [ Server A IP ]
and
telnet 158.69.174.80 3306
Trying 158.69.174.80...
telnet: Unable to connect to remote host: Connection refused
You can see your issue here
MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
+--------+---------------+
| User | Host |
+--------+---------------+
| remote | [ Server A IP ] |
+--------+---------------+
You really need [Server B IP] here
GRANT ALL ON <DB>.* TO 'remote'#'server_B_IP';
This should do it.
Set MYSQL bind-address to 0.0.0.0 because it usually only listens on 127.0.0.1 by default.
RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
The issue was because the MySQL user {user}#{IP} had the {IP} as the IP of the MySQL-hoster server, not the IP of server which was connecting to the host; {IP} is used for the IP of the client which is connecting to the server.
I am trying to run a simple Python http server that displays "hello world" on port 8080 using a micro instance. I also have 4 instances of Tornado running behind Nginx. Connecting to Nginx/Tornado on port 80 is not a problem.
I have added port 8080 to my firewall settings, and ensured port 8080 is open and listening on the server but no matter what I do, my connection is always refused. I have tried connecting using browsers, telnet and wget and every single connection is refused.
Here is the output of netstat -an | grep "LISTEN "
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8001 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8002 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8003 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:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp6 0 0 :::8000 :::* LISTEN
tcp6 0 0 :::8001 :::* LISTEN
tcp6 0 0 :::8002 :::* LISTEN
tcp6 0 0 :::8003 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
Here is my iptables list
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http-alt
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Here is the Python script I am using:
#!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
PORT_NUMBER = 8080
#This class will handles any incoming request from
#the browser
class myHandler(BaseHTTPRequestHandler):
#Handler for the GET requests
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
# Send the html message
self.wfile.write("Hello World!")
return
try:
#Create a web server and define the handler to manage the
#incoming request
server = HTTPServer(('', PORT_NUMBER), myHandler)
print 'Started httpserver on port ' , PORT_NUMBER
#Wait forever for incoming htto requests
server.serve_forever()
except KeyboardInterrupt:
print '^C received, shutting down the web server'
server.socket.close()
Does your network have the corresponding firewall rule? Follow the next steps to create it.
Go to the Developers Console and click on the corresponding project.
Click on 'Compute'
Click on 'Networks'
Click on the name of the corresponding network. You can see in which network is your instance clicking on 'VM instances' under the 'Compute Engine' section or with the command:
gcloud compute instances describe <instance> | grep "network:" | awk -F/ '{print $(NF)}'
Under the Firewall rules section, click 'Create new'
Enter a name for the firewall rule and in the field 'Protocols & ports' type: tcp:8080
Save the rule
After that, you should be able to access your HTTP server.
Otherwise you can try to see if your machine receives the SYN TCP packets in that port with the command: sudo tcpdump -i eth0 port 8080
Hope it helps
In GCE Web Console > Networks > Firewall rules > edit your RULE, remove TARGET TAGS and apply.
GL
probably somethings goes wrong when You've created the network rule. When a network rule is described and related MetaTag is created, assure that the VMs instances contain the same MetaTag, so the wanted traffic will be redirected to the machine.
Still not sure what went wrong, but I deleted my instance and network then created new ones. The new instance and network seem to be working fine, so I can only assume something went wrong when playing around with the old network as the new one doesn't seem to have the same problem.
make sure to add the right port.
the answer above states "tcp:80" , but this will not work if your server is running on another port.
thats probably the reason why it is not working for others
In GCE Web Console, goto Networks > Firewall rules > create firewall rule,
then
input a name for the new rule
choose "all instance in the network" for targets
put 0.0.0.0/0 in source IPv4 ranges
checkbox TCP and input 8080 as port
and save