Problem with virsh / cannot connect to qemu - qemu

I am trying to setup KVM, but when running $ sudo virsh net-define br10.xml I get this:
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
And when jumping into virt-manager GUI a get this dialog Unable to connect to libvirt qemu:///system.
I checked if I am in both kvm and libvirt groups and that seems okay.
I also checked if the libvrt-sock file is created when running $ sudo systemctl start libvirtd.service but there is nothing.

So it showed up that privilges for my files wasn't set correctly. Now everything works

Related

Error while running mysql_secure_installation on arch linux

I'm trying to install MySQL(pure) on Arch Linux so I downloaded the following file from https://dev.mysql.com/downloads/mysql/.
mysql-8.0.26-linux-glibc2.17-x86_64-minimal-rebuild.tar.xz
I extracted it and tried to run ./mysql_secure_installation but after I enter the root password I get the following error message:
[rob#archrob bin]$ sudo ./mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
How can I fix this?
I tried to download it from AUR repository too but when I run the makepkg -si it get a point of the installation it looks like will take forever.
Build files have benn written to /home/rob/mysql/src/build
[0%] Built target INFO_BIN
[0%] built target abi_check
[0%] built target INFO_SRC
[0%] Building CXX object extra/protobuf...
[0%] and so on...
After one hour it was at [22%] so I stopped the installation and tried from the official website.
You'll need to start mariadb before running mysql_secure_installation:
$ sudo systemctl start mariadb.service

Docker MySql Service Only Starts As Admin and Never Stays on with AWS AMI 2018.3

I am creating a development/testing container that contains a number of elements including a mysql server that must run internally for code to access. To demonstrate the issue, I run the following Dockerfile with docker run -i -t demo_mysql_server:
FROM amazonlinux:2018.03
RUN yum -y update && yum -y install shadow-utils mysql-server
Unfortunately, after building the docker container I receive a common connection error (see 1, 2)
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
which can be fixed by logging in as admin with docker run -i -u 0 -t demo_mysql_server
and executing:
echo "NETWORKING=yes" >/etc/sysconfig/network
service network restart
/etc/init.d/mysqld start
chkconfig mysqld on
which seems to turn everything on. However, incorporating these into RUN commands doesn't seem to keep the service on and logging in as admin requires restarting the service as above and adding a user and working as a non-admin and trying to start the service results in errors of the flavor:
bash: /etc/sysconfig/network: Permission denied
[testUser#544a938c44c1 /]$ service network restart
[testUser#544a938c44c1 /]$ /etc/init.d/mysqld start
/etc/init.d/mysqld: line 16: /etc/sysconfig/network: No such file or directory
[testUser#544a938c44c1 /]$ chkconfig mysqld on
You do not have enough privileges to perform this operation.
I this a normal error to see and how do I get the MySQL server instance to stay running?

Hadoop - No route to host while configuring HUE

I have installed hue on my local ubuntu system and installed hadoop muti cluster system on two system.
Hadoop Version : 2.7.3
Hue Version : 3.12.0
Ozzie Version : 4.3.0
I am facing issue when I am running sqoop job process from mysql to import data from HDFS. I am getting following error.
Caused by: java.net.NoRouteToHostException: No Route to Host from Developer4/127.0.0.1 to cm:10020 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host; For more details see: http://wiki.apache.org/hadoop/NoRouteToHost
HDFS url hdfs://master:9000
My /etc/hosts file like
192.168.1.149 master
127.0.0.1 developer4
192.168.1.161 slave
Please suggest me where I am doing wrong. Even ozzie command for start and stop command work properly on command line.
You have set Hadoop in your localhost system then you need to remove or modified below things in core-site.xml file.
mapreduce.jobhistory.address 0.0.0.0:10020 Host and port for Job History Server (default 0.0.0.0:10020)
After that you need to run jobhistoryservice with below command.
sbin/mr-jobhistory-daemon.sh --config /home/developer4/hadoop-2.7.3/etc start historyserver
After this command port is enable on your localhost and hope this will help you.

Can't connect to MySQL server on '127.0.0.1' (61) on Mac

Having some trouble creating a mysql connection. The mysql instance is running in system preferences and I have made sure the mysql config file is in the right location(Test settings passed). When I go into Test DB connections I get red cross on all three sections.(open database connections, get server version, get server OS). Running mac 10.10.2. Set connection name as home hostname as 127.0.0.1, port as 3306, username as root, password as my computers root password and default schema as home as well. Any ideas?
Delete pid files using this command:
$ cd /usr/local/var/mysql
$ sudo rm -rf [networkname*].err
$ sudo rm -rf [networkname*].pid
Now restart server use brew sevices
$ brew services restart mysql
∗your network name like "Tanbirs-Mac-mini.local"
(use echo $HOST)
You can see this type of error , try this:
run this command on your iTerm or Terminal:
sudo mysql.server start
If you see some errors like this:
my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Starting MySQL
.my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (OS errno 2 - No such file or directory)
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
ERROR! The server quit without updating PID file (/usr/local/var/mysql/MacBook-Pro.local.pid).
Just make the dir:
mkdir /usr/local/etc/my.cnf.d
and then run it again:
sudo mysql.server start
Works for me.
I just had this and the only solution that worked for me was to remove the ib_logfile* files from /usr/local/var/mysql, similar to Engr.Tanbir Hasan's answer:
cd /usr/local/var/mysql
rm ib_logfile*
Then restart with (I'm using MariaDB, but same applies to MySQL):
brew services restart mariadb
# or
brew services restart mysql
I found the solution here.
Today i have come with this issue, i solved it using the following steps:
First, check whether listening to the port 3306:
netstat -tulpen
if it prints the following log, it would be right:
...
tcp6 0 0 :::3306 :::* LISTEN 27 46396 22054/mysqld
...
otherwise, edit the file my.cnf and add the code to it:
bind-address = 0.0.0.0
it means that it listens to all ports.
Secondly, in the CentOS 7 add the Mysql service to firewall:
sudo firewall-cmd --zone=public --permanent --add-service=mysql
it returns Success, and then going on executing the command:
sudo systemctl restart firewalld
Now, it's OK!!!
brew install mysql worked for me
Then brew services start mysql
I had the same issue and I updated following settings on MAMP/MySQL - Allow Network Access to MySQL to "Only From this Mac" and it fixed the issue for me. I have attached a screenshot here. Also port should be updated to 8889 instead of 3306.
I had same problem, but it worked for me.
check if you have mysql installed
If you don't have mysql installed, download from this link: https://dev.mysql.com/downloads/mysql/
follow this instructions to install
https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/osx-installation-pkg.html
You can test the connection without any problem.
(Sorry for my english, I agree fix me please)
I Hope I've helped.
Greetings.
The database I use is dependent on DBngin running so this was the error I had.
Close your database management tool and then open the DBngin app and start mysql services. Then when you connect it'll have the database appear to allow you to connect

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