第一部分 应用篇 -- 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统

Tokyo Cabinet 是日本人 平林幹雄 开发的一款 DBM 数据库,该数据库读写非常快,哈希模式写入100万条数据只需0.643秒,读取100万条数据只需0.773秒,是 Berkeley DB 等 DBM 的几倍。

点击在新窗口中浏览此图片



Tokyo Tyrant 是由同一作者开发的 Tokyo Cabinet 数据库网络接口。它拥有Memcached兼容协议,也可以通过HTTP协议进行数据交换。

  Tokyo Tyrant 加上 Tokyo Cabinet,构成了一款支持高并发的分布式持久存储系统,对任何原有Memcached客户端来讲,可以将Tokyo Tyrant看成是一个Memcached,但是,它的数据是可以持久存储的。这一点,跟新浪的Memcachedb性质一样。

本日志由 flyinweb 于 2012-05-18 14:36:12 发表到 数据库技术 中,目前已经被浏览 32 次,评论 0 次;

作者添加了以下标签: TTserverTokyo CabinetTokyo Tyrant

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

假设:
A.数据库servername: testserver
B.数据库名:testdb
C.SQL脚本文件:
sqlfile.sql
  1. create table test_table(c1 integer);  
  2. insert into test_table(c1) values(12);  
  3. update test_table set c1=0;  
  4. delete test_table where 1=1;  
  5. drop table test_table; 
sqlfile2.sql
  1. create table test_table(c1 integer);  
  2. insert into test_table(c2) values(12);  
  3. insert into test_table(c1) values(12);  
  4. update test_table set c1=0;  
  5. delete test_table where 1=1;  
  6. drop table test_table;  
--------------------------------------------------------------------------------

一、执行SQL脚本文件方式
1.调用dbaccess执行SQL脚本文件
A、简单执行SQL文件
$ dbaccess testdb sqlfile.sql
或者
$ dbaccess testdb@testserver sqlfile.sql
Database selected.
Table created.
1 row(s) inserted.
1 row(s) updated.
1 row(s) deleted.
Table dropped.
Database closed.

本日志由 flyinweb 于 2012-04-13 14:37:25 发表到 数据库技术 中,目前已经被浏览 202 次,评论 0 次;

作者添加了以下标签: informix dbaccess

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

症状:

环境:Informix Dynamic Server 2000 Version 9.21.UC2

原来操作正常,进行查询时,出现如下错误:

  243: Could not position within a table (informix.tablename)

  111: ISAM error:  no record found.
Error in line 6
Near character position 1

本日志由 flyinweb 于 2012-04-10 18:23:59 发表到 数据库技术 中,目前已经被浏览 278 次,评论 0 次;

作者添加了以下标签: err 243Could not position within a table

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

Windows MySQL Backup Script

@ECHO OFF


REM ============================
REM == SETTINGS ================

SET BACKUPS_DIR=Z:/mysqlbackup/
SET MYSQL_DIR=%PROGRAMFILES%\MySQL\MySQL Server 5.1\bin
SET USER="backup_user"
SET PASSWORD="backup_password"   

SET SHAREPATH="\\192.168.148.9\14875"
SET NETUSER="netuser"
SET NETPWD="netpwd"

ECHO map network drive
NET USE Z: %SHAREPATH% %NETPWD% /USER:%NETUSER%

REM ============================

SET OLDDIR=%CD%
CD %TEMP%

REM The date in ISO format, to be appended to backup filenames.
REM (Working from a UK formatted date)
REM SET TODAY=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%
SET TODAY=%date:~0,10%

REM get a list of all databases hosted on the server
"%MYSQL_DIR%\mysql" -u %USER% -p%PASSWORD% -B -s -e"show databases" > mysqldblist.tmp

FOR /F %%D IN (mysqldblist.tmp) DO (
    ECHO Creating backup for database ''%%D''
    "%MYSQL_DIR%\mysqldump" -u %USER% -p%PASSWORD% --default-character-set=utf8 --result-file="%BACKUPS_DIR%\%%D_%TODAY%.sql" "%%D"
)

DEL mysqldblist.tmp

CD %OLDDIR%

ECHO Disconnect the mapped drive
NET USE Z: /DELETE

:: AutoMySQLBackupForWindows Servers By Matt Moeller v.1.2
:: RED OLIVE DESIGN INC.

:: Follow us on twitter for updates to this script twitter.com/redolivedesign
:: coming soon: email admin a synopsis of the backup with total file size(s) and time it took to execute

:: UPDATE 12.29.2011 Thanks to Kamil Tomas for catching and resolving the time bug

::If the time is less than two digits insert a zero so there is no space to break the filename

set year=%DATE:~10,4%
set day=%DATE:~7,2%
set mnt=%DATE:~4,2%
set hr=%TIME:~0,2%
set min=%TIME:~3,2%

IF %day% LSS 10 SET day=0%day:~1,1%
IF %mnt% LSS 10 SET mnt=0%mnt:~1,1%
IF %hr% LSS 10 SET hr=0%hr:~1,1%
IF %min% LSS 10 SET min=0%min:~1,1%

set backupdate=%year%-%day%-%mnt%-%hr%-%min%

:: MySQl DB user
set dbuser=root

:: MySQl DB users password
set dbpass=123xyz

:: Switch to the MySQL data directory and collect the folder names
pushd "c:\MySQL\data"

:: Loop through the folders and use the fnames for the sql filenames, collects all databases automatically this way

echo "hello"

echo "Pass each name to mysqldump.exe and output an individual .sql file for each"

FOR /D %%F IN (*) DO (
"c:\MySQL\bin\mysqldump.exe" --user=%dbuser% --password=%dbpass% --databases %%F > "c:\MySQLBackups\backupfiles\%%F.%backupdate%.sql"
)

echo "Zipping all files ending in .sql in the folder"

"c:\MySQLBackups\zip\7za.exe" a -tzip "c:\MySQLBackups\backupfiles\FullBackup.%backupdate%.zip" "c:\MySQLBackups\backupfiles\*.sql"

echo "Deleting all the files ending in .sql only"

del "c:\MySQLBackups\backupfiles\*.sql"

echo "Deleting zip files older than 30 days now"
Forfiles -p c:\MySQLBackups\backupfiles\ -s -m *.* -d -30 -c "cmd /c del /q @path"
echo "All done, pretty slick eh"

::FOR THOSE WHO WISH TO FTP YOUR FILE UNCOMMENT THESE LINES AND UPDATE - Thanks Kamil for this addition!

::cd\[path to directory where your file is saved]
::@echo off
::echo user [here comes your ftp username]>ftpup.dat
::echo [here comes ftp password]>>ftpup.dat
::echo [optional line; you can put "cd" command to navigate through the folders on the ftp server; eg. cd\folder1\folder2]>>ftpup.dat
::echo binary>>ftpup.dat
::echo put [file name comes here; eg. FullBackup.%backupdate%.zip]>>ftpup.dat
::echo quit>>ftpup.dat
::ftp -n -s:ftpup.dat [insert ftp server here; eg. myserver.com]
::del ftpup.dat

本日志由 flyinweb 于 2012-03-30 11:27:46 发表到 数据库技术 中,目前已经被浏览 203 次,评论 0 次;

作者添加了以下标签: MySQL Backup

A basic installation contains at least 2 database servers and 1 monitoring server. In this guide, I used 5 servers with Debian Lenny (5.0)

functioniphostnameserver id
monitoring host192.168.0.10mon-
master 1192.168.0.11db11
master 2192.168.0.12db22
slave 1192.168.0.13db33
slave 2192.168.0.14db44

I used the following virtual IPs. They will be distributed across the hosts by MMM.

iproledescription
192.168.0.100writerYour application should connect to this IP for write queries.
192.168.0.101readerYour application should connect to one of these four IPs for read queries
192.168.0.102reader
192.168.0.103reader
192.168.0.104reader

本日志由 flyinweb 于 2012-01-31 16:19:48 发表到 数据库技术 中,目前已经被浏览 310 次,评论 0 次;

作者添加了以下标签: Multi-Master Replication Manager for MySQLmysql-mmm

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

一、MMM简介:

MMMMaster-Master Replication Manager for MySQLmysql主主复制管理器)关于mysql主主复制配置的监控、故障转移和管理的一套可伸缩的脚本套件(在任何时候只有一个节点可以被写入),这个套件也能对居于标准的主从配置的任意数量的从服务器进行读负载均衡,所以你可以用它来在一组居于复制的服务器启动虚拟ip,除此之外,它还有实现数据备份、节点之间重新同步功能的脚本。

MySQL本身没有提供replication failover的解决方案,通过MMM方案能实现服务器的故障转移,从而实现mysql的高可用。

MMM项目来自 Googlehttp://code.google.com/p/mysql-master-master

官方网站为:http://mysql-mmm.org

Mmm主要功能由下面三个脚本提供

lmmm_mond负责所有的监控工作的监控守护进程,决定节点的移除等等

lmmm_agentd运行在mysql服务器上的代理守护进程,通过简单远程服务集提供给监控节点

lmmm_control通过命令行管理mmm_mond进程

本日志由 flyinweb 于 2012-01-31 16:04:20 发表到 数据库技术 中,目前已经被浏览 412 次,评论 0 次;

作者添加了以下标签: mysql-mmmMulti-Master Replication Manager for MySQL

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

 Last month we released the Beta of VS 2010 Service Pack 1 (SP1). You can learn more about the VS 2010 SP1 Beta from Jason Zander’s twoblog posts about it, and from Scott Hanselman’s blog post that covers some of the new capabilities enabled with it. You can download and install the VS 2010 SP1 Beta here.

Last week I blogged about the new Visual Studio support for IIS Express that we are adding with VS 2010 SP1. In today’s post I’m going to talk about the new VS 2010 SP1 tooling support for SQL CE, and walkthrough some of the cool scenarios it enables.

本日志由 flyinweb 于 2012-01-04 11:24:14 发表到 数据库技术 中,目前已经被浏览 501 次,评论 0 次;

作者添加了以下标签: VS 2010 SP1SQL CESQL Server Compact Edition

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

.NET Compact Framework Data Provider for SQL Server Mobile

Type.NET Framework Class Library
UsageSystem.Data.SqlServerCe.SqlCeConnection
ManufacturerMicrosoft

Standard

Data Source=MyData.sdf;Persist Security Info=False;

How to specify the location of the SDF file

Often times the .SDF database is not running in the current directory so it becomes necessary to programatically set the path to the SDF file. This is an example (.net C#) on how to do this when the SDF file is located in the same directory as the executing application.

本日志由 flyinweb 于 2012-01-04 10:55:51 发表到 数据库技术 中,目前已经被浏览 366 次,评论 0 次;

作者添加了以下标签: SQL Server Compact EditionConnection strings

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

1391/18