1

I am doing a small project to achieve auto-completion on ubuntu. I run the code in Docker with hadoop. I also use Ampps downloaded from http://ampps.com/download.

But I have a problem that I can't solve. When I am trying to write the data into the MySQL. I have the problem as above.

"Error: java.io.IOException: Communications link failure".

One to mention, I have two mapreduce. The first map and reduce work. The second map works. The second reduce doesn't work. And nothing updated in MySQL.

I was told to check my IP address in the Driver class in the following code:

DBConfiguration.configureDB(conf2,
                 "com.mysql.jdbc.Driver",   // driver class
                 "jdbc:mysql://192.168.1.22:3306/test", // db url 
                 "root",    // user name
                 "root"); //password

I use this code below to search my IP address:

ifconfig | grep inet | grep Bcast

the result is as below:

      inet addr:172.18.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
      inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
      inet addr:169.254.9.173  Bcast:169.254.255.255  Mask:255.255.0.0
      inet addr:192.168.1.22  Bcast:192.168.1.255  Mask:255.255.255.0

I add these address into mysql user list and give them all the privilege:

 GRANT ALL ON *.* to 'root'@'ip_address' IDENTIFIED BY 'your-password'; 
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'ip_address' WITH GRANT OPTION;

I have tried every IP address. It still doesn't work.

Another detail to mention, when I start the AMPPS

cd /usr/local/ampps
sudo ./Ampps

There is a warning that

"The apache port is being taken by another application"

I think it doesn't matter although I don't know how to solve this problem. I restart the computer and immediately start the Ampps. The port will not be taken if I don't use the browser first. The problem is still the same. I also upload my code to github. The link is https://github.com/Wangzishan199277/Auto-completion

I really don't know how to solve this problem. Any answer would be great!

0

You must log in to answer this question.

Browse other questions tagged .