Tuesday, February 26, 2013

How to configure MySQL server in linux and connect from remote server?

I recently required to connect to start the MySQL server and connect it from another client machine remotely. It wasn't too easy as I expected and I came across couple of issues during this, and I thought of blog it as it'll be useful to for someone else also. :)

These are steps I followed during this.

  • Install the MySQL server.
                sudo apt-get install mysql-server

  • Connect to MySQL server with 
                mysql --user=root --password=root

  • Did ifconfig from my machine to find out my ip-address.
  • And then used that ip address to connect to the MySQL server
               mysql --host=x.x.x.x --user=root --password=root

         Then I got the below error.
               ERROR 2003 (HY000): Can't connect to MySQL server on 'x.x.x.x' (111)

  • The above error comes because of the bind-address of my sql server. In my.cnf file the bind-address of the my sql server has been mentioned and when the my sql server start up it'll bind to that address. By default the address in which is the loop back address, and we can't connect via this address from another machine remotely.  The address you specify in bind tells mysql where to listen. is a special address, which means "bind to every available network".
           Go to /etc/mysql/my.cnf  and change the bind address to
  • Then again when i tried to connect using the same command remotely I encountered the below error.
          "ERROR 1130 (HY000): Host 'hostname' is not allowed to connect to this MySQL server".

  • After a bit of research, the fix in my case was to "GRANT" user root to connect to MySQL on any hosts. By default, user "root" was only allowed to connect to localhost and hosts of MySQL. 

            #GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '<roots-password>' WITH GRANT OPTION;
After all the configuration above I could connect MySQL server remotely.:-)

Some useful tips:
- Start the my sql server ---> sudo service mysql start
- Stop the my sql server ---> sudo service mysql stop

Thursday, February 14, 2013

Load Balancing Data Publishers and Sending Events to Multiple Receivers

WSO2 BAM/CEP has hight performance thrift based event receiving model, which basically receives the events via TCP. Even though thrift is high performance receiving protocol, load balancing the thrift events is problematic as you need tcp based load balancer rather http based load balancer. Therefore in WSO2 we have added support to have load balancing between Data bridge receivers (ie, WSO2 BAM servers, CEP servers) from the client side, by sending the events in a round robin manner to BAM servers, such that load of events will be balanced between them.

For this we have added a Wrapper class called LoadBalancingDataPublisher, which uses the AsyncDataPublisher in it. It not only load balances the events between the set of servers and also can send same events to some servers. All the capabilities of using the LoadBalancingDataPublisher is provided in BAM 2.2.0 documentation here, which explains the use cases of using the load balancing data publisher.

This provides more fail over handling also with load balancing, which can detect the node failure and stop further publishing for the dead node and it also recognozes the node startup and it starts load balancing the events from that instance.

I'll provide a more detailed description about using LoadDataPublisher to publish events to BAM/CEP in next article.