Sockets in FlexCDC consumer

26 views
Skip to first unread message

KoPoS

unread,
Jul 5, 2011, 3:06:46 AM7/5/11
to flexviews-discuss
Hi

Thank you! for flexviews. It is an excellent product which solves a
very obvious painpoint for us.I recently started using flexviews for
an internal project. Our replication server uses sockets to connect to
the mysql server.

So I made a very trivial code change to make this work.

===

In consumer.ini : Added the line for socket

;The SOURCE is where the change logs are read from. This does not
have to be the same as the local machine.
;this user requires "grant replication client,replication slave"
[source]
user=root
host=localhost
port=3307
password=root@sbn
socket=/var/lib/mysql/mysql.sock

===

In include/flexcdc.php

if(!empty($settings['flexcdc']['bulk_insert']) && $settings['flexcdc']
['bulk_insert'] != 'false') {
$this->bulk_insert = true;
}

/* Code to support Unix sockets */
$S['server'] = (isset($S['socket'])? "{$S['host']}:{$S['socket']}":
$S['H'] = "{$S['host']}:{$S['port']}";
$D['server'] = (isset($D['socket'])? "{$D['host']}:{$D['socket']}":
$D['H'] = "{$D['host']}:{$D['port']}";

$this->source = mysql_connect($S['server'], $S['user'],
$S['password'], true) or die1('Could not connect to MySQL server:' .
mysql_error());
$this->dest = mysql_connect($D['server'], $D['user'],
$D['password'], true) or die1('Could not connect to MySQL server:' .
mysql_error());

$this->settings = $settings;

==

In include/flexcdc.php $this->dest was changed to $this->source

$sql = "SELECT @@binlog_format";
$stmt = my_mysql_query($sql, $this->source);

==

Can you please verify if this is expected.

./kopos

KoPoS

unread,
Jul 5, 2011, 3:14:43 AM7/5/11
to flexviews-discuss
Please take note of the typos in code for the $S['server']

$S['server'] = (isset($S['socket']))? "{$S['host']}:
{$S['socket']}" : "{$S['host']}:{$S['port']}";
$D['server'] = (isset($D['socket']))? "{$D['host']}:
{$D['socket']}" : "{$D['host']}:{$D['port']}";

Apologies.
Reply all
Reply to author
Forward
0 new messages