Re: distributed database architecture for a large database

2003-07-03 Thread Guy Davis
On June 28, 2003 05:33 am, Aodhan Cullen wrote:
 6/27/03 6:37:49 PM, Jeremy Zawodny [EMAIL PROTECTED] wrote:
  My read/update ratio would be something along the lines of 1:3, 3
  updates for every read. So it is highly unusual, and more or less
  rules replication out of the picture.
 
 I'm unclear why you can't use replication for this.  There must be an
 assumption about what you're doing that we do not share.
 
 If you read from the slave and write to the master, why does this not
 work?

 A slave would simply not be able to keep up, replication works really well
 if you have a lot of reads, and a small number of updates. This is reverse
 ways, and needs a different approach.

Actually, I've found MySQL replication to be extremely fast.  Our database is 
also atypical having over 70% writes to 30% or less reads.  However, we have 
yet to have a slave (of 2 or 3) not be able to keep up.  In fact, I can bring 
a slave that has been pasued for a few days (as a snapshot) up to speed again 
within an hour or two.

Here's some stats on our setup:
- Queries per second avg: 117.236
- Generating over a 1GB of binlog entries per day.
- Running with ~120 GB of live data now (used to be 200+ but we have 
  an archival scheme now)

Not sure how this compares to your situation.

-- 
Guy Davis http://www.guydavis.caCalgary, Alberta, Canada


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Mod_Auth_MySQL for Apache 2 and Windows?

2003-01-24 Thread Guy Davis
Just wondering whether anyone had a working, compiled mod_auth_mysql
module for doing basic auth against a MySQL database on a Windows system
(XP to be exact).  If not, has anyone ever compiled one on Windows?

I found one for Apache 2.0.43 at this site:
http://www.pcp-computer.de/gkn/apache/httpd-2.0/win32/modules/

but it only crashes the Apache server.  (Other people have had the same
problem with this version as well.)

-- 
Guy Davis  Phone: (403) 301-3426   Fax: (403) 301-3499
Pason Systems  Calgary, AlbertaCanada

Digitally signed by GnuPG (DSA ID 759A998E at www.keyserver.net)
PGP Fingerprint: F685 97D0 0FC6 F016 E9EB CCD3 F183 1BC7 759A 998E 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Mod_Auth_MySQL for Apache 2 and Windows?

2003-01-24 Thread Guy Davis
Just wondering whether anyone had a working, compiled mod_auth_mysql
module for doing basic auth against a MySQL database on a Windows system
(XP to be exact).  If not, has anyone ever compiled one on Windows?

I found one for Apache 2.0.43 at this site:
http://www.pcp-computer.de/gkn/apache/httpd-2.0/win32/modules/

but it only crashes the Apache server.  (Other people have had the same
problem with this version as well.)

-- 
Guy Davis http://www.guydavis.caCalgary, Alberta, Canada

Digitally signed by GnuPG (DSA ID 30D52F0B at www.keyserver.net)
PGP Fingerprint: 8DC8 4A6F C1AD 393B 39DB CDBF 196D 31D0 30D5 2F0

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: secure replication

2002-10-28 Thread Guy Davis
On Thu, 2002-10-24 at 20:26, Lists @ Apted Technologies Inc. wrote:
 i am going to be setting up four mysql servers, three of which will
 replicate data off of the primary. i know that in more recent versions of
 mysql client/server communciations can be encrypted internally.  but is
 there any way to encrypt replication communcations between these mysql
 servers internally so i don't need to set up a vpn or ssl tunnel?  thanks
 all.

Setting this up with SSH is quite easy.  I have a How-To on it at:

http://www.guydavis.ca/projects/oss/docs/ssh_mysql.jsp

-- 
Guy Davis http://www.guydavis.caCalgary, Alberta, Canada

Digitally signed by GnuPG (DSA ID 30D52F0B at www.keyserver.net)
PGP Fingerprint: 8DC8 4A6F C1AD 393B 39DB CDBF 196D 31D0 30D5 2F0

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Help: SIGSEGV inside mysql_connect to remote server

2002-05-02 Thread Guy Davis

On Thu, 2002-05-02 at 00:38, Jeremy Zawodny wrote:
 On Wed, May 01, 2002 at 04:24:05PM -0600, Guy Davis wrote:
 
  I am having a really strange problem with a in-house C application
  that calls mysql_connect() and generates a segfault deep within
  uname() when I configure it to contact a remote server.  Using a
  local MySQL server works fine as uname is never called.
  
  Have any of you ever seen anything like this?
 
 Is that remote server's info in /etc/hosts on the client?  If not, see
 if that makes a difference.


Yes, adding the remote server's line to /etc/hosts clears up the
problem.  Does that meant that our DNS server is somehow misconfigured. 
Issuing 'host dev.pason.com' at the command line gives me the correct IP
address.  

Here's /etc/host.conf:   order hosts,bind

Thanks.

-- 
Guy Davishttp://www.guydavis.ca
PGP: D2E2 76D4 0C9C 5D99 42AA  EB6B B9C2 68CA 2DC7 F2E4

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Help: SIGSEGV inside mysql_connect to remote server

2002-05-01 Thread Guy Davis

I am having a really strange problem with a in-house C application that
calls mysql_connect() and generates a segfault deep within uname() when
I configure it to contact a remote server.  Using a local MySQL server
works fine as uname is never called.

Have any of you ever seen anything like this?  Here's the backtrace from
gdb:

Program received signal SIGSEGV, Segmentation fault.
0x0807a086 in uname ()
(gdb) bt
#0  0x0807a086 in uname ()
#1  0x4011da96 in getdomainname (name=0x4019f240 , len=1024)
at ../sysdeps/generic/getdomain.c:40
#2  0x40191ae6 in nis_local_directory () at nis_local_names.c:68
#3  0x40181cb0 in _nss_create_tablename (errnop=0x808c720)
at nss_nisplus/nisplus-hosts.c:183
#4  0x40182223 in internal_gethostbyname2_r (name=0xb5b0
dev.pason.com, 
af=2, host=0x40170620, buffer=0x808fda0 \177, buflen=1024, 
errnop=0x808c720, herrnop=0xb178, flags=0)
at nss_nisplus/nisplus-hosts.c:338
#5  0x401825ca in _nss_nisplus_gethostbyname_r (
name=0xb5b0 dev.pason.com, host=0x40170620, buffer=0x808fda0
\177, 
buflen=1024, errnop=0x808c720, h_errnop=0xb178)
at nss_nisplus/nisplus-hosts.c:447
#6  0x40135cc0 in __gethostbyname_r (name=0xb5b0 dev.pason.com, 
resbuf=0x40170620, buffer=0x808fda0 \177, buflen=1024, 
result=0xb174, h_errnop=0xb178) at ../nss/getXXbyYY_r.c:200
#7  0x401356da in gethostbyname (name=0xb5b0 dev.pason.com)
at ../nss/getXXbyYY.c:131
#8  0x0805b8cc in mysql_real_connect ()
#9  0x0805d90c in mysql_connect ()
#10 0x08070385 in ssConnectDB (databaseName=0x8073c85 hub) at
_ssmysql.c:52

Any idea what this could be?  Any idea on how I could try to track it
down?  My feeling is that this is most likely something wrong with our C
application.  However, it calls ssConnectDB right near the beginning of
main(), so there isn't much opportunity for memory errors.

Thanks.

-- 
Guy Davis   Phone:   (403) 301-3426   
Pason Systems   Fax: (403) 301-3499
PGP: 65BA 484B 0B96 5F3B 4D40  DCA2 B2AE 6B5A F52B 1445

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Rotation of binary logs on replication master?

2002-03-22 Thread Guy Davis

On Thu, 2002-03-21 at 13:07, Shawn McCool wrote:
 /usr/local/bin/mysql -hhostname -uusername -ppassword -e flush logs;

I guess I wasn't clear that I wanted old binary logs removed.  I don't
want to have to manually worry about disk space due to ever increasing
binary logs.

It seems to me FLUSH LOGS just opens a new binary log.  The old, unused
ones are still left in place.  I'm looking for a rotating set of say 4
kept.  Anything older is deleted.  Logrotate does this for Apache's logs
for example.

The RESET command seems to delete all binary logs.  I don't want them
all deleted, just very old ones.  Any ideas?  Thanks.

Flush logs did the following:

[root@nachos root]# du -h /var/lib/mysql/nachos*
4.0k/var/lib/mysql/nachos-bin.001
700M/var/lib/mysql/nachos-bin.002
4.0k/var/lib/mysql/nachos-bin.003
1.1G/var/lib/mysql/nachos-bin.004
350M/var/lib/mysql/nachos-bin.005
4.0k/var/lib/mysql/nachos-bin.006
189M/var/lib/mysql/nachos-bin.007
384M/var/lib/mysql/nachos-bin.008
4.0k/var/lib/mysql/nachos-bin.009
1.1G/var/lib/mysql/nachos-bin.010
289M/var/lib/mysql/nachos-bin.011
1.1G/var/lib/mysql/nachos-bin.012
1.1G/var/lib/mysql/nachos-bin.013
684M/var/lib/mysql/nachos-bin.014
4.0k/var/lib/mysql/nachos-bin.index
332k/var/lib/mysql/nachos-slow.log
4.0k/var/lib/mysql/nachos.us.pason.com.pid

mysql FLUSH LOGS;

[root@nachos root]# du -h /var/lib/mysql/nachos*
4.0k/var/lib/mysql/nachos-bin.001
700M/var/lib/mysql/nachos-bin.002
4.0k/var/lib/mysql/nachos-bin.003
1.1G/var/lib/mysql/nachos-bin.004
350M/var/lib/mysql/nachos-bin.005
4.0k/var/lib/mysql/nachos-bin.006
189M/var/lib/mysql/nachos-bin.007
384M/var/lib/mysql/nachos-bin.008
4.0k/var/lib/mysql/nachos-bin.009
1.1G/var/lib/mysql/nachos-bin.010
289M/var/lib/mysql/nachos-bin.011
1.1G/var/lib/mysql/nachos-bin.012
1.1G/var/lib/mysql/nachos-bin.013
684M/var/lib/mysql/nachos-bin.014
4.0k/var/lib/mysql/nachos-bin.015
4.0k/var/lib/mysql/nachos-bin.index
332k/var/lib/mysql/nachos-slow.log
4.0k/var/lib/mysql/nachos.us.pason.com.pid

-- 
Guy Davis   Phone:   (403) 301-3426   
Pason Systems   Fax: (403) 301-3499
PGP: 65BA 484B 0B96 5F3B 4D40  DCA2 B2AE 6B5A F52B 1445

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Rotation of binary logs on replication master?

2002-03-21 Thread Guy Davis

Just wondering if any Linux users of MySQL out there had written a
logrotate configuration file for dealing with MySQL binary logs on a
replication Master.

I want to rotate these logs (6.5 GB now) as some are over a month old. 
However, I don't want to confuse any of the replicating slaves.  Any
tips?

Thanks.

-- 
Guy Davis   Phone:   (403) 301-3426   
Pason Systems   Fax: (403) 301-3499
PGP: 65BA 484B 0B96 5F3B 4D40  DCA2 B2AE 6B5A F52B 1445

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re-baselining replication slaves?

2002-03-01 Thread Guy Davis

I started replicating the MySQL DB on our production server last month. 
I was wondering if anyone who has been doing replication for a while has
seen the need to resync the slave.  (i.e. snapshot the master, install
on slave, and re-start replication from snapshot)

Are there systems out there that have been replicating for a year plus
with no troubles?  Thanks.

-- 
Guy Davis   Phone:   (403) 301-3426   
Pason Systems   Fax: (403) 301-3499
PGP: 65BA 484B 0B96 5F3B 4D40  DCA2 B2AE 6B5A F52B 1445

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Running Without TCP Port

2002-02-22 Thread Guy Davis

On Fri, 2002-02-22 at 11:09, havoc wrote:
 Is it possible to run mysqld without binding to a TCP port?
 As in run using only unix sockets?

Start with --skip-networking:

http://www.mysql.com/doc/C/o/Command-line_options.html

or put skip-networking into your my.cnf file.

-- 
Guy Davis   Phone:   (403) 301-3426   
Pason Systems   Fax: (403) 301-3499
PGP: 65BA 484B 0B96 5F3B 4D40  DCA2 B2AE 6B5A F52B 1445

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: insert picture file in MySQL (+php)

2002-02-14 Thread Guy Davis

On Thu, 2002-02-14 at 08:42, Eric Torr Klopper wrote:
 How would you go about doing this. Could somebody send me some sample
code and also explain how to get the image link into the database so I
can access the image. I'm fairly new to MySql and 
 PHP so any help on this will be appreciated.

I use this for the photo album on my web site (http://www.guydavis.ca).
It's not a high traffic site by any means, so performance isn't an
issue.  Can't show you PHP, but here's what I did in an Java servlet. 
It handles uploaded (POST) images from friends.  byte_out is a
ByteArrayOutputStream.  imageIcon is an Icon that I create using JDK
1.4's headless AWT support to allow me to calculate the image's
thumbnail dimensions.

  Connection con = WebUtils.getConnection();
  String st = INSERT INTO photos (location, description, date_shot,
filename, mimetype, img_data, ;
  st += height, width, thumb_height, thumb_width, category, access,
title) ;
  st += VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
  PreparedStatement stmnt = con.prepareStatement(st);
  stmnt.setString(1, ((String) params.get(location)));
  stmnt.setString(2, ((String) params.get(description)));
  stmnt.setString(3, date);
  stmnt.setString(4, (image.getFileName()));
  stmnt.setString(5, image.getContentType());
  stmnt.setBytes(6, byte_out.toByteArray());
  stmnt.setInt(7, imageIcon.getIconHeight());
  stmnt.setInt(8, imageIcon.getIconWidth());
  stmnt.setInt(9, thumb_height);
  stmnt.setInt(10, thumb_width);
  stmnt.setInt(11, Integer.parseInt((String) params.get(category)));
  stmnt.setString(12, (String) params.get(access));
  stmnt.setString(13, ((String) params.get(title))); 
  stmnt.executeUpdate();

Given that most of the photos posted by myself and friends are personal,
I needed an access control system and I wanted something more robust
than a publicly accessible image with a random name.  The only way to do
that is to have a servlet or CGI read in a image from disk or database
(where's it's not web accessible) and write the data out to the client.

Here's the relevant code from my PhotoServlet:

  String query = SELECT * FROM photos WHERE id=+id;
  ResultSet rs = WebUtils.doSQL(query);
  if (!rs.first()) {
displayError(request, response);
return;
  }  

  // if it's marked personal, only logged in people should see it
  if ((rs.getString(access).equalsIgnoreCase(Personal))  
(session.getValue(login) == null)) {
displayError(request, response);
return;
}

  if (rs.getString(filename).toUpperCase().indexOf(.GIF) =
0)  
response.setContentType(image/gif);   
  else
response.setContentType(image/jpeg);  

  Blob img_blob = rs.getBlob(img_data);
  InputStream in = img_blob.getBinaryStream();
  while (in.available()  0)
  buf_out.write(in.read());
  buf_out.flush();
  buf_out.close();  


Here's the CREATE TABLE for my photos table:

photos | CREATE TABLE `photos` (
  `id` smallint(5) unsigned NOT NULL auto_increment,
  `location` varchar(255) NOT NULL default '',
  `description` mediumtext NOT NULL,
  `date_shot` date NOT NULL default '-00-00',
  `filename` varchar(255) NOT NULL default '',
  `mimetype` varchar(50) NOT NULL default '',
  `height` smallint(5) unsigned default NULL,
  `width` smallint(5) unsigned default NULL,
  `thumb_height` smallint(5) unsigned default NULL,
  `thumb_width` smallint(5) unsigned default NULL,
  `img_data` longblob,
  `category` smallint(5) unsigned default NULL,
  `access` enum('Public','Personal') default 'Personal',
  `title` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM


I don't see why you shouldn't be able to do something similar in PHP.
Hope this helps.

-- 
Guy Davis   Phone:   (403) 301-3426   
Pason Systems   Fax: (403) 301-3499
PGP: 65BA 484B 0B96 5F3B 4D40  DCA2 B2AE 6B5A F52B 1445

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




ADO to MySQL interface?

2002-02-13 Thread Guy Davis

Hi all,

The company I work for is a Linux shop using MySQL almost exclusively, 
however we're partnering with Windows-only shop to tie their application
into our overall product offering. 

Their app uses ADO as it's database interface and they say it will work
with Oracle, MS SQL Server, and MS Access.  I'm wondering if there is an
ADO adapter out there that will work with MySQL.  I know of the ODBC
connector, but I'm told ADO replaces ODBC(?).

If possible we'd like to stick with MySQL, rather than paying large
licensing fees for either Oracle or SQL Server.

-- 
Guy Davis   Phone:   (403) 301-3426   
Pason Systems   Fax: (403) 301-3499
PGP: 65BA 484B 0B96 5F3B 4D40  DCA2 B2AE 6B5A F52B 1445

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php