Nameserver limits were exceeded while installing k3s - mysql

I want to install Rancher in a Ubuntu server (v18.04). I am following this doc and I want to install k3s. When I install using the command
curl -sfL https://get.k3s.io | sh
everything works.
But when I try to install it using a MySQL database as the doc says:
curl -sfL https://get.k3s.io | sh -s - server \
--datastore-endpoint="mysql://root:mypassword#tcp(localhost:3306)/dbk3s"
I received the following error:
Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is
MySQL server is running with no problem at all and I already created dbk3s database. It look likes the problem is related with the fact that Ubuntu is limited with just 3 DNS nameserver records and 6 DNS search records but I am not sure.

Related

Creating a MySQL cluster, using mysql-server docker containers, on multiple servers

I'm trying to create an MySQL cluster of 3 nodes using mysql-server docker containers.
I have 3 separate cloud instances and docker is setup on all 3 of them. Each server will have only 1 container running on it - to achieve High Availability when in cluster.
I start the containers on all 3 servers, individually, with the command
docker run --name=db -p 3301:3306 -v db:/var/lib/mysql -d mysql/mysql-server
I'm mapping the port 3306 of container to my server's 3301 port. I've also created a new user 'clusteradmin' for remote access.
Next, from mysql-shell, I ran following command - for all 3 servers
dba.configureInstance('clusteradmin#serverIp:3301')
I get similar message for all-
Note that it says 'This instance reports its own address as 39xxxxxxxxxx:3306'.
Next I create a cluster in one of the server successfully. But, when adding the other 2 servers to this cluster, I'm getting the following error
On checking the logs for that particular server, I see the following lines
It says 'peer address a9yyyyyyyyyy:33061 is not valid'. This is because, since the containers are running on different servers, the container-id is not recognised by other containers on other server.
I tried many options but to no avail. One method was to use report-host and report-port options when starting the container, like so
docker run --name=db2 -p 3301:3306 -v db2:/var/lib/mysql -d mysql/mysql-server --report-host=139.59.11.215 --report-port=3301
But, the issue with this approch is that, during dba.configureInstance(), it wants to update the port to default value and throws error like so
Anybody who has managed to create such a cluster of mysql-server containers running on different servers, I would really appreciate pointers in this regard.
I have gone over the documentation and source code but have not found an explanation why listening and advertising different ports is problematic.
I have solved the problem by using --port 3301 when invoking mysql-server:
docker run --name=db2 -p 3301:3301 -v db2:/var/lib/mysql -d mysql/mysql-server --report-host=139.59.11.215 --port 3301

Cannot access hawkular metrics

I have install openshift origin 3.9 using inventory file like you. I have used below line for metrics installation:
openshift_metrics_install_metrics=true
openshift_metrics_hawkuler_hostname=hawkular-metrics.example.com
openshift_master_metrics_public_url=https://hawkular-metrics.example.com/hawkular/metrics
And I installed using inventory file with prerequisites.yaml and then deploy_cluster.yaml, so that hawker-cassandra, hawkular-metrics and heapster in running condition and oc adm top node command is working.
But problem is cannot access hawkular metrics by below command:
curl -H "Athorization :Bearer XXXXX" -H "Hawkular-Tenant:openshift-infra" -X GET https://hawkular-metrics.example.com/hawkular/metrics/metics
Showing error:
could not resolve host:hawkular-metrics.example.com,unknown error.
To deploy metrics and access metrics should I need any thing extra for this version?
Is hawkular-metrics.example.com/hawkular/metrics/metics accessible from client? Either a DNS Server or a local /etc/hosts entry should resolve hawkular-metrics.example.com to the node where router pod resides.

PDOException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

I have an EC2 instance where Laravel 5 app is hosted. The DB is Amazon Aurora RDS. The app has been running fine for months. But this morning the API was unreachable. Everything else works apart from any calls to the API that uses DB. Other calls are serving fine. The error was recorded as:
PDOException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
But I could connect to the same DB from MySQL Workbench etc using the same exact details and nothing has changed in the app files in the meantime.
I restarted the Nginx and the problem is solved straight away and everything resumed to normal.
I still don't know what happened. Anyone could educate me on this as I am not sure if the problem can come back again randomly and how to stop that from happening.
Same problem here on AWS EC2 with Ubuntu 14.04. Unattended upgraded last night :
2017-03-21 03:42:53,570 INFO Packages that will be upgraded: libc-bin libc-dev-bin libc6 libc6-dev libfreetype6 libfreetype6-dev locales multiarch-support
Just created a case on ubuntu bug tracker : https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1674733
Please click on "This bug affects me" to prioritize the fix on ubuntu side.
They've issues a fix. See this link and the instructions at the bottom for your distro. https://www.ubuntu.com/usn/usn-3239-2/
I am experiencing the exact same issue. Ubuntu 16.04, PHP and Drupal - just started this morning. I have been reloading apache on an off all morning and that temporarily resolves it:
service apache2 reload
But that doesn't permanently fix it and it has come back a couple of times again.
We just experienced the same today. We are running Drupal 7 on a Ubuntu 16.04 box with PHP 7.0, nginx in EC2 connecting to an RDS instance.
We do have unattended upgrades enabled and the following was upgraded this morning:
Start-Date: 2017-03-21 06:13:56
Commandline: /usr/bin/unattended-upgrade
Upgrade: libc6:amd64 (2.23-0ubuntu3, 2.23-0ubuntu6), locales:amd64 (2.23-0ubuntu3, 2.23-0ubuntu6), libc-bin:amd64 (2.23-0ubuntu3, 2.23-0ubuntu6), multiarch-support:amd64 (2.23-0ubuntu3, 2.23-0ubuntu6), libfreetype6:amd64 (2.6.1-0.1ubuntu2, 2.6.1-0.1ubuntu2.1)
End-Date: 2017-03-21 06:14:00
The solution was to restart nginx and PHP:
sudo service nginx restart
sudo service php7.0-fpm restart
As of March 20th, many Ubuntu users across the web were suddenly having DNS resolution issues pop up in their applications due to a bad update pushed out by Canonical (the maintainers of Ubuntu) which breaks DNS resolution after a few hours of uptime. Here's the bug report where the issue was reported and triaged:
https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1674532
This may have resulted in failures of your CMS to update/install plugins/install themes, failures to connect to external APIs, and/or error messages similar to the following:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname
Could not resolve host: downloads.wordpress.org
cURL error 6: Could not resolve host: example.com in....
Fortunately Canonical has since been able to resolve the issue, but affected systems must update to acquire the fix. To do that, you'll need DNS working, so if it's currently down please first reboot your Droplet. Once DNS resolution is working as normal, please run:
sudo apt-get update
sudo apt-get upgrade
Then you can check your versions to ensure you've got the right ones. This can be done with:
# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
If you're on Ubuntu 16.X, you should see output similar to the following:
# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
2.23-0ubuntu7
2.23-0ubuntu7
2.23-0ubuntu7
If you're on Ubuntu 14.X, you should see output similar to the following:
# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
2.19-0ubuntu6.11
2.19-0ubuntu6.11
If you see older versions of those packages, you'll need to upgrade per the previous instructions to avoid this issue.

how to setup and configure mysql-proxy on ubuntu on amazon ec2

i am trying to setup mysql-proxy on ubuntu on amazon ec2
i have done following:
sudo apt-get install mysql-proxy --yes
vi /etc/default/mysql-proxy
i put following content on "/etc/default/mysql-proxy"
ENABLED="true"
OPTIONS="--proxy-lua-script=/usr/share/mysql-proxy/rw-splitting.lua
--proxy-address=127.0.0.1:3306
--proxy-backend-addresses=private_ip_of_another_ec2_db_server:3306,private_ip_of_another_ec2_db_server:3306"
also tied with "--proxy-address=private_ip_or_public_ip_of_proxy-server:3306 or 4040"
and "--proxy-backend-addresses=public_ip_of_another_ec2_db_server:3306,public_ip_of_another_ec2_db_server:3306"
after that i tried to connect proxy server from another pc using mysql like:
mysql -u some_user -pxxxxx -h proxy_server_ip
or
mysql -u some_user -pxxxxx -h proxy_server_ip -P 4040
but its not working
its showing error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'ip' (10061)
i want to tell you can connect the db server remotely where i allowed remote connection to any host
i also tried /etc/init.d/mysql-proxy start or /etc/init.d/mysql-proxy restart but no result
just to inform you that /etc/init.d/mysql-proxy stop is showing failed
can anyone please help me to setup and configure mysql-proxy on ubuntu
===
Edit
i found some help from other question of stackoverflow and also according to a suggestion in the comments, have done following procedure. and it seems its working now.
i installed mysql-client and mysql-server locally(on proxy server)
then i tried to run mysql-proxy using following command:
mysql-proxy --proxy-backend-addresses=10.73.151.244:3306 --proxy-backend-addresses=10.73.198.7:3306 --proxy-address=:4040 --admin-username=root --admin-password=root --admin-lua-script=>/usr/lib/mysql-proxy/lua/admin.lua
then i tried to connect remotely to the proxy server and its working.
but it seems i need to run this command under screen because when i close the terminal proxy stops working.
Can you please tell me that do i need to run this command under screen or is there any other way to make it alive all time?
There is no need to install Mysql client or Mysql Server on your mysql-proxy.
Installing mysql-proxy does have "full daemon capabilities" compiled into it.
If your are running Ubuntu Server, you may wish to use an UPSTART service script.
This script can be copied into /etc/init/mysql-proxy.conf
# mysql-proxy.conf (Ubuntu 14.04.1) Upstart proxy configuration file for AWS RDS
# mysql-proxy - mysql-proxy job file
description "mysql-proxy upstart script"
author "shadowbq <shadowbq#gmail.com>"
# Stanzas
#
# Stanzas control when and how a process is started and stopped
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Essentially lets upstart know the process will detach itself to the background
expect daemon
# Run before process
pre-start script
[ -d /var/run/mysql-proxy ] || mkdir -p /var/run/mysql-proxy
echo "starting mysql-proxy"
end script
# Start the process
exec /usr/bin/mysql-proxy --plugins=proxy --proxy-lua-script=/usr/share/mysql-proxy/rw-splitting.lua --log-level=debug --proxy-backend-addresses=private_ip_of_another_ec2_db_server:3306,private_ip_of_another_ec2_db_server:3306 --daemon --log-use-syslog --pid-file=/var/run/mysql-proxy/mysql-proxy.pid
In the above example I hard coded the AWS RDS server into script, instead of fiddling with defaults and config file
Install Upgraded version 0.8.5
Note:
apt repo does not have 0.8.5 so we need to download tar from mysql official site
Prerequisite :-
Create file /etc/default/mysql-proxy with following content
ENABLED="true"
OPTIONS="--defaults-file=/etc/mysql/mysql-proxy.cnf"
Installation Procedure :-
Download mysql-proxy 0.8.x
Untar in /usr/local
Update PATH environment with /usr/local/mysql-proxy-0.8.5-linux-debian6.0-x86-64bit/bin
vim /etc/environment (to update environment path)
cd /usr/local/mysql-proxy-0.8.5-linux-debian6.0-x86-64bit/bin
Run command sudo ./mysql-proxy --defaults-file=/etc/mysql/mysql-proxy.cnf
Sample mysql-proxy.cnf file
[mysql-proxy]
log-level=debug
log-file=/var/log/mysql-proxy.log
pid-file = /var/run/mysql-proxy.pid
daemon = true
--no-proxy = false
admin-username=ADMIN
admin-password=ADMIN
proxy-backend-addresses=RDS-ENDPOINT:RDS-PORT
admin-lua-script=/usr/lib/mysql-proxy/lua/admin.lua
proxy-address=0.0.0.0:4040
admin-address=localhost:4041
change host ip and port of RDS or mysql
connect to Mysql server via proxy with
mysql -h{proxy-host-ip} -P 4040 -u{mysql_username} -p

Cannot find MySQL -- get "command not found" error when trying to access MySQL from command line

I have previously installed, connected and uploaded to a WordPress MySQL database via SSH no problem. The people who run my server made a few configuration changes, and now I get a "bash: mysql: command not found" error when I try to log into MySQL via the command line on the same server to access the same database.
I am relatively new to all of this, so I am really not sure what to do. When I run "which mysql" I get a message that says there is no MySQL executable in the /usr/bin directories. I can verify that MySQL is running between the fact that my site is still live and functioning and when I ran a command to test MySQL, I got a message that said "MySQL works!"
I find MySQL files in several directories, but I'm not really sure what I am looking for and how I connect to it when I do find it. I am also not sure if this is user error, or if somehow someone moved or hid MySQL from me -- likely user error??
A MySQL server is not a MySQL client.
Check if MySQL is running by executing this command:
ps aux | grep mysql | grep -v grep
And install the MySQL client:
sudo apt-get install mysql-client # Or your distribution command
If you have MySQL server up and running on your server, it does not mean you have a MySQL client installed on this server.
Try
ls -l /usr/bin/mysql*
Do you see MySQL binaries exactly present on system?
One more problem: Linux has very strange behaviour when you run binaries for another architecture.
For example, if you run a 32-bit executable on 64-bit system you will get an error message like "command or file not found", even if the binaries are actually present!
Now mysql-client has changed to default-mysql-client.
Hence the command:
sudo apt-get install default-mysql-client
Although MySQL is running, if you are not able to connect to the server using the mysql command, then you might be missing to provide soft links:
sudo ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
sudo ln -s /usr/local/mysql/bin/mysql /usr/bin
This should enable you to connect.
In order to get MySQL CLI working or to access the mysql command from anywhere, there are a set of steps to be done to add it to the $PATH variable.
First, open a terminal, and run the following command
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
Then to reload the Bash profile, run
. ~/.bash_profile
Now run,
mysql -u root -p
Enter the password which you gave during installation. You should see the following result:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.23 MySQL Community Server - GPL
You sometimes need to install MySQL on the local machine as well. That means, if you have a host running a MySQL Docker container, the strange thing happened to me that I needed to install mysql-server on the host as well, not only in the container.
The reason was that there was a shell script that needed to check the right database name from a query. In your case, it might be something different. On your host machine (which might even be your local computer, depending the your setup), if on Linux, try:
sudo apt-get update && sudo apt-get install mysql-server
Then you will get rid of
/home/.../some_bash_script.sh: line 123: mysql: command not found