MySQL Forums
Forum List  »  Router & Proxy

Re: Connection errors with rw-splitting.lua
Posted by: Ludovico Magnocavallo
Date: October 29, 2007 05:22AM

Here is the script I am using. As I stated in the above message, the weird thing is I only get the disconnect when running the rw-split script against the remote server.

#!/usr/bin/env python2.4

import atexit
import MySQLdb

def main(host, port):

    port = int(port)
    pool = list()

    for i in range(20):
        print i,
        try:
            conn = MySQLdb.connect(db='xx', user='xx', passwd='xx', host=host, port=port)
        except MySQLdb.Error, e:
            print e
        else:
            print 'ok'
            cursor = conn.cursor()
            #res = cursor.execute("set names utf8")
            pool.append((conn, cursor))
            atexit.register(conn.close)

    return pool

if __name__ == '__main__':
    import sys
    main(*sys.argv[1:])



Edited 1 time(s). Last edit at 10/29/2007 10:24AM by Ludovico Magnocavallo.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Connection errors with rw-splitting.lua
3035
October 29, 2007 05:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.