<body>

kenshou

天空没有飞过的痕迹,但我已经努力飞过……

MySQL Proxy 安装与读写分离体验(主要为转载内容)

转载内容http://blog.csdn.net/yueliangdao0608/archive/2008/05/06/2398655.aspx
-------------------
一、必备软件:
1、LUA
可以去LUA的官方下载:www.lua.org
2、MySQL Proxy
这里有好多二进制版本。
http://mysql.cdpa.nsysu.edu.tw/Downloads/MySQL-Proxy/
或者去MYSQL官方下载源代码。
二、软件安装
1、LUA
[[email protected] ~]#tar zxvf lua-5.1.2.tar.gz -C /usr/local
[[email protected] ~]# cd /usr/local/
[[email protected] local]# mv lua-5.1 lua
[[email protected] lua]# cd lua
[[email protected] lua]#make local;make install;
导出环境变量:
[[email protected] lua]#export LUA_CFLAGS="-I/usr/local/include" LUA_LIBS="-L/usr/local/lib -llua -ldl" LDFLAGS="-lm"
2、MySQL Proxy 安装
[[email protected] ~]#tar -zxvf mysql-proxy-0.6.1-linux-rhel4-x86-32bit.tar.gz -C /usr/local/mysql/
[[email protected] ~]#cd /usr/local/mysql
[[email protected] mysql]#mv mysql-proxy-0.6.1-linux-rhel4-x86-32bit/ mysql-proxy
[[email protected] sbin]# export PATH=$PATH:/usr/local/mysql/mysql-proxy/sbin/

3、启动MySQL-Proxy(测试读写分离)
[[email protected]]# mysql-proxy--proxy-read-only-backend-addresses=192.168.0.236:3306--proxy-backend-addresses=192.168.0.235:3306 --proxy-lua-script=/usr/local/mysql/mysql-proxy/share/mysql-proxy/rw-splitting.lua&
[1] 32554
让MYSQL PROXY自动启动的简单脚本
#!/bin/sh
# export PATH=$PATH:/usr/local/mysql-proxy
cd /usr/local/mysql-proxy
./mysql-proxy--proxy-read-only-backend-addresses=192.168.0.236:3306--proxy-backend-addresses=192.168.0.235:3306--proxy-lua-script=rw-splitting.lua >> /tmp/log
------------------------------
注意:在启动的时候把LUA_PATH加入进去,不然会出现找不lua脚本的问题。测试的时候要多启动几个客服端才能测试出来
LUA_PATH="/usr/local/mysql/mysql-proxy/share/mysql-proxy/?.lua" /usr/local/mysql/mysql-proxy/sbin/mysql-proxy --proxy-read-only-backend-addresses=192.168.1.10:3306 --proxy-backend-addresses=192.168.1.9:3306 --proxy-lua-script=/usr/local/mysql/mysql-proxy/share/mysql-proxy/rw-splitting.lua


参考url地址:
1:http://blog.csdn.net/yueliangdao0608/archive/2008/05/06/2398655.aspx
2:http://bbs.chinaunix.net/archiver/tid-1066681.html

标签:

jsp编码问题



jsp页面设置了%@ page language="java" pageEncoding="utf-8"%,
然后页面也写了meta http-equiv="content-type" content="text/html;charset=utf-8;" /,
但是页面提交的参数到这个页面总是不能显示中文,
在服务器段把参数进行了utf8,gbk,iso8859-1的手动转换都不行,
后来想到jsp没有经过编码过滤器的过滤,
手动在页面中加个request.setCharacterEncoding("utf-8");
哈哈,整个世界都中文化了,oh yeah,我喜欢中文的世界

标签: , ,

为MYSQL添加远程用户(转载)



from : http://blog.csdn.net/Coolingverse/archive/2006/04/11/658847.aspx

在安装MySql后只有一个超级管理权限的用户ROOT,而且ROOT限制只能在数据库本机上使用,如果我们要远程管理MySql咋办呢?那么事实上我们需要添加一个具有超级管理权限并且可能远程访问的超级用户,而在MySql中有两种方法可以实现这个目的,我们以增加一个超级权限管理用户admin为例来说明。

你可以通过发出GRANT语句增加新用户:首先在数据库本机上用ROOT用户登录上MySql(不用我告诉你如何登录吧?),然后:

mysql>GRANT ALL PRIVILEGES ON *.* TO [email protected] IDENTIFIED BY 'something' WITH GRANT OPTION;
mysql>GRANT ALL PRIVILEGES ON *.* TO [email protected]"%" IDENTIFIED BY 'something' WITH GRANT OPTION;

第一句增加了一个admin用户授权通过本地机(localhost)访问,密码“something”。第二句则是授与admin用户从任何其它主机发起的访问(通配符%)。

你也可以直接通过发出INSERT语句增加同样的用户存取信息:
mysql>INSERT INTO user VALUES('localhost','admin',PASSWORD('something'), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
mysql>INSERT INTO user VALUES('%','admin',PASSWORD('something'), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')

取决于你的MySQL版本,对上述,你可能必须使用一个不同数目'Y'值(在3.22.11以前的版本有更少的权限列)。
转载于http://hi.baidu.com/ashuy/blog/item/3cb7bb996882c2086f068c7c.html

标签:

mysql完整的编译参数(转载)



为良好的支持中文

编译的时候采用
--with-charset=gbk \设置字符集
--with-extra-charsets="gbk gb2312 big5 utf8"
完整的编译参数(根据用途不同可能不一样)
# ./configure
--prefix=/usr/local/mysql \ 指定安装目录
--sysconfdir=/etc \ 指定my.ini的位置
--localstatedir= ar b/mysql \mysql数据存放处
--with-unix-socket-path= ar b/mysql/mysql.sock \mysql动态连接库
--with-debug
--without-debug \去除debug模式
--with-charset=gbk \设置字符集
--with-extra-charsets="gbk gb2312 big5 utf8"
--enable-assembler \使用一些字符函数的汇编版本
--without-isam \去掉isam表类型支持 isam表是一种依赖平台的表
--without-innodb \去掉innodb表支持 innodb是一种支持事务处理的表,适合企业级应用
--with-pthread \强制使用pthread库(posix线程库)
--enable-thread-safe-client \以线程方式编译客户端
--with-mysqld-ldflags=-all-static \以纯静态方式编译服务端和客户端
--with-raid \激活raid支持

转载于http://blog.sina.com.cn/s/blog_5919c3a7010009gn.html

标签:

apache2和tomcat5.5的整合(转载)



tar xvfz jakarta-tomcat-connectors-1.2.15-src.tar.gz
cd jakarta-tomcat-connectors-1.2.15-src/jk/native/
./buildconf.sh
./configure --with-apxs=/opt/bokee/httpd/bin/apxs --with-java-
make
make install

在/opt/bopkee/httpd/conf/http.conf文件中加入以下代码:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile "/opt/bokee/httpd/conf/workers.properties"
JkLogFile "/opt/bokee/httpd/logs/mod_jk2.log"
JkLogLevel error
JkMount /photoadmin/* worker1
JkMount /photoblog/* worker1

新建此文件/opt/bokee/httpd/conf/workers.properties,内容如下
ps=/
#指定文件路径分割符
worker.list=worker1
worker.worker1.port=8009
#工作端口,若没占用则不用修改
worker.worker1.host=localhost
#Tomcat服务器的地址
worker.worker1.type=ajp13
#类型
worker.worker1.lbfactor=1

apache的启动:
/opt/bokee/httpd/bin/apachectl start 启动
/opt/bokee/httpd/bin/apachectl restart 重启
/opt/bokee/httpd/bin/apachectl stop 停止

标签: ,

(转载)apache2的安装



tar -zvxf httpd-2.0.55.tar.gz
cd httpd-2.0.55
./configure --prefix=/opt/bokee/httpd --enable-module=so --enable-rewrite=shared --enable-proxy --with-mpm=worker --with-threads=yes
make
make install



以上安装即可。
备注:
./configure --prefix=/opt/bokee/httpd --enable-module=so --with-mpm=worker --with-threads=yes
(--enable-module=so为和tomcat整合用; --with-mpm=worker是2.0 版中全新的支持多线程和多进程混合模型的MPM)

apache动态编译mod_rewrite模块

/opt/bokee/httpd/bin/apxs -ci /opt/bokee/soft/httpd-2.0.55/modules/mappers/mod_rewrite.c

转载于:http://hi.baidu.com/hrhero/blog/item/1447561ce29e958e86d6b65d.html

标签:

转载:启动mysql时报错的解决(mysql 5.0.45 redhat as 43)

启动mysql时报错:
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
071112 00:22:06 mysqld ended

查看日志:

#less /var/log/mysqld.log

其中有一段如下:

071112 0:22:06 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2)
071112 0:22:06 [ERROR] Can't start server: can't create PID file: No such file or directory
071112 00:22:06 mysqld ended

#cd /var/run/
#ls

mysqld目录不存在,创建它:

#mkdir /var/run/mysqld
#cd /var/run/mysqld

创建文件mysqld.pid:

#touch mysqld.pid
#cd..
#chown -R mysql mysqld .

#cd /usr/local/mysql/
#bin/mysqld_safe --user=mysql &
nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql

能正常启动

#bin/mysqladmin -u root password root

又出错

[[email protected] mysql]# bin/mysqladmin -u root password root
bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

[[email protected] mysql]# bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

分析:是/tmp/mysql.sock 不存在

# cd /var/lib/mysql/

由于mysql 默认的mysql.sock 是在/var/lib/mysql/mysql.sock,创建符号连接:

# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
# bin/mysql -u root
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.0.45 MySQL Community Server (GPL)

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql>

修改root 密码

#cd /usr/local/mysql/
#bin/mysqladmin -u root -p password yourpassword

一切ok。

转载地址为:http://lawzjf.itpub.net/post/417/451262

标签:

linux下面mysql 安装(转载)

tar -zxvf mysql-5.1.11-beta.tar.gz
cd mysql-5.1.11-beta
./configure --prefix=/usr/local/mysql
make && make install
groupadd mysql
useradd -g mysql mysql
cd /usr/local/
cd mysql/
bin/mysql_install_db --user=mysql
chown -R root .
chgrp -R mysql . chown -R mysql var(数据目录,一定都是mysql的权限)
/usr/local/mysql/bin/mysqld_safe & //mysql启动
/usr/local/mysql/bin/mysqladmin stop //mysql关闭

转载于http://hi.baidu.com/hrhero/blog/item/ab3bbbdf7d04ff164854032b.html

标签: