[root@c1g ~]# perl -MCPAN -e shell
Terminal does not support AddHistory.
cpan shell — CPAN exploration and modules installation (v1.7602)
ReadLine support available (try ‘install Bundle::CPAN’)
cpan>o conf init
一路回车
关注互联网、网页设计、Web开发、服务器运维优化、项目管理、网站运营、网站安全…
[root@c1g ~]# perl -MCPAN -e shell
Terminal does not support AddHistory.
cpan shell — CPAN exploration and modules installation (v1.7602)
ReadLine support available (try ‘install Bundle::CPAN’)
cpan>o conf init
一路回车
rev="post-1181" No comments
– 2011/02/23
中国联通集团IDC运营中心介绍
为加强联通全网业务的专业化运营和管理,中国联通集团IDC运营中心于2008年3月27日正式成立。在北方10省和上海、广东、江苏、浙江、福建、陕西、重庆、四川、江西、安徽、湖北共21省分公司设立省级IDC运营分中心,在全国四星级以上IDC所在的16个中心城市设有地市级IDC运营分中心。
主要职能:
· 负责联通全国IDC业务的运营管理;
· 负责提出全国IDC经营预算目标和发展策略、规划和实施;
· 负责全网IDC服务等级评审,全网IDC资源调度;
· 负责跨省客户签约审核;
· 负责IDC产品的规划、开发与合作,对新产品进行定价、培训;
· 负责全网性及国际性大客户业务拓展的支撑;
· 协助联通IDC品牌的建立和维护;
· 负责全网流量流向、资源和客户信息等支撑平台的数据统计分析等。
联通机房分布
截止2009年11月25日联通官方公布的共有 13个五星机房及24个四星机房。
其中山东最为历害,有4个接入超过100G的机房,开通时间也比较新,但是代理商很少。
1u 百共的代理价格大概是6000/年。
机房名称 | 地址 | 星级水平 | 详细 | 机房面积 | 总接入带宽 | 机房设计机架数 | 机房现有机架数 | 机房开通时间 | |
四川成都IDC | 成都市二环路北一段111-114号 | 四星级 | 查看 | 1000平方米 | 5G | 180 | 2003年6月 | ||
沈阳IDC | 沈阳市铁西区滑翔路29号 | 四星级 | 查看 | 1000平方米 | 90G | 344 | 2003年1月 | ||
陕西西安IDC | 西安市高新区科技六路19号 | 四星级 | 查看 | 1100平方米 | 40G | 200 | 2008年4月 | ||
青岛秦岭路IDC | 青岛市苗岭路11号 | 四星级 | 查看 | 2000平方米 | 200G | 503 | 三楼2001年10月 四楼2009年7月 |
||
济南二枢纽IDC | 济南市经十路168号 | 四星级 | 查看 | 2000平方米 | 150G | 600 | 2001年4月 | ||
内蒙古自治区IDC | 呼和浩特市金川开发区联通第二枢纽楼 | 四星级 | 查看 | 5000平方米 | 40G | 500 | 2005年7月 | ||
大连软件园IDC | 大连市软件园数码路北段28号 | 四星级 | 查看 | 1500平方米 | 60G | 384 | 2002年 | ||
长春二枢纽IDC | 长春市硅谷大街3057号联通二枢纽10楼 | 四星级 | 查看 | 1500平方米 | 40G | 250 | 2007年1月 | ||
黑龙江IDC | 哈尔滨市南岗区湘江路45号 | 四星级 | 查看 | 5500平方米 | 40G | 1000 | 400 | 2007年5月 | |
河南郑州二长枢纽IDC | 河南省郑州市北环路40号 | 四星级 | 查看 | 3600平方米 | 40G | 1000 | 500 | 2005年1月 | |
河北石家庄IDC | 石家庄市东开发区昆仑大街89号 | 四星级 | 查看 | 3500平方米 | 60G | 630 | 2002年12月 | ||
中深国际IDC | 深圳市南山区科技园深南花园C座裙楼2楼 | 四星级 | 查看 | 1070平方米 | 20G | 91 | 2002年1月 | ||
广州太阳广场IDC | 广州市天河天阳路142-144号太阳广场 | 四星级 | 查看 | 6000平方米 | 20G | 197 | 2002年11月 | ||
深南花园IDC机房 | 深圳市南山区科技园深南花园C座裙楼2楼 | 四星级 | 查看 | 2470平方米 | 20G | 197 | 2006年1月 | ||
北京亦庄电话局IDC | 北京市大兴区中和街1号 | 四星级 | 查看 | 1000平方米 | 8G | 411 | 2008年 | ||
北京西三旗电话局IDC | 北京市海淀区西三旗 | 四星级 | 查看 | 760平米 | 8G | 323 | 2008年 | ||
北京西红门电话局IDC | 北京大兴区西红门镇内宏康路 | 四星级 | 查看 | 2000平米 | 20G | 804 | 2008年 | ||
北京石景山电话局IDC | 北京市石景山老古城前街甲2号 | 四星级 | 查看 | 590平米 | 8G | 242 | 2008年 | ||
北京上地电话局IDC | 北京市海淀区上地信息产业基地 | 四星级 | 查看 | 730平米 | 8G | 321 | 2008年 | ||
北京南苑电话局IDC | 北京市丰台区三营门 | 四星级 | 查看 | 1200平米 | 8G | 450 | 2008年 | ||
北京酒仙桥IDC | 北京市朝阳区酒仙桥路14号D区1号楼 | 四星级 | 查看 | 4000平米 | 8G | 931 | 2008年 | ||
北京广内电话局IDC | 北京市宣武区槐柏树街13号 | 四星级 | 查看 | 460平米 | 8G | 153 | 2008年 | ||
北京东四电话局IDC | 北京东四南大街164号 | 四星级 | 查看 | 700平米 | 20G | 264 | 2008年 | ||
山东青岛二枢纽IDC | 青岛市辽阳东路15号 | 五星级 | 查看 | 6000平方米 | 200G | 1460 | 960 | 2006年3月1日 | |
山东济南担山屯IDC | 济南市经十西路京福高速入口西行300米路南 | 五星级 | 查看 | 4500平米 | 150G | 658 | 458 | 2009年10月 | |
黑龙江哈尔滨IDC | 哈尔滨市南岗区中山路155号 | 五星级 | 查看 | 5000平米 | 40G | 600 | 500 | 2002年12月1日 | |
广州科学城IDC | 广州萝岗区科学城天丰路11号 | 五星级 | 查看 | 4200平米 | 20G | 1600 | 230 | 2007年11月 | |
天津华苑IDC | 天津市南开区新技术产业园区华苑产业区梓苑路6号 | 五星级 | 查看 | 18064平米 | 60G | 807 | 2009年7月 | ||
天津滨海IDC | 天津市塘沽开发区新城东路和盛达街交口 | 五星级 | 查看 | 3800平米 | 80G | 1343 | 2005年1月 | ||
上海漕河泾IDC | 上海市徐汇区钦州北路1089号51号楼 | 五星级 | 查看 | 5500平米 | 12G | 1540 | 1100 | 2002年 | |
北京皂君庙IDC | 北京市海淀区皂君庙路9号 | 五星级 | 查看 | 3800平米 | 50G | 890 | 2005年 | ||
北京亦庄IDC | 北京市亦庄经济技术开发区北环东路1号 | 五星级 | 查看 | 3760平 | 60G | 1314 | |||
北京土城IDC | 北京市朝阳区土城裕民路乙三号 | 五星级 | 查看 | 4500平米 | 80G | 1108 | 2005年 | ||
北京数字北京大厦IDC | 北京市北辰西路12号 | 五星级 | 查看 | 3000平米 | 20G | 1048 | 2006年 | ||
北京三元桥IDC | 北京市朝阳区霞光里2号 | 五星级 | 查看 | 400平米 | 40G | 160 | 2006年 | ||
北京电报大楼IDC | 北京市西长安街11号电报大楼 | 五星级 | 查看 | 2600平米 | 60G | 887 | 2005年 |
一、主机托管业务
(一)安装调测费:一次性收取。
1.端口调测费:机位出租中独享端口方式按每个端口300元收取,共享端口方式按照每台机器200元收取;
2.设备安装费:设备安装按照每台设备200元收取,机架出租和VIP专用机房(机笼)出租按每机架1000元收取。
(二)月租费:各省公司根据区域的不同,执行该区域对应的价格体系,并根据IDC等级执行不同档次的价格。
1.空间使用费(含机位费、机架费):
区域分类
|
用户单台设备高度H
(单位:U)
|
机位费(元/月/U)
|
||||
五星级
|
四星级
|
三星级
|
二星级
|
一星级
|
||
AA类、
A类地区
|
1≤H﹤3
|
440
|
350
|
280
|
220
|
180
|
3≤H﹤7
|
400
|
320
|
260
|
200
|
160
|
|
7≤H
|
350
|
280
|
220
|
180
|
140
|
|
单个标准机架/柜(44U及以下)
|
10000
|
8000
|
6500
|
5000
|
4000
|
|
VIP机房(机笼)费
|
对应的机架资费×同等面积公共区域可放置的机架个数×130%
|
|||||
B类、
C类地区
|
1≤H﹤3
|
350
|
280
|
220
|
180
|
140
|
3≤H﹤7
|
320
|
250
|
200
|
160
|
130
|
|
7≤H
|
280
|
220
|
180
|
140
|
110
|
|
单个标准机架/柜(44U及以下)
|
8000
|
6500
|
5000
|
4000
|
3500
|
|
VIP机房(机笼)费
|
对应的机架资费×同等面积公共区域可放置的机架个数×130%
|
注:(1)机位费指用户托管设备与其他用户设备共享一个机架时用户缴纳的空间资源占用费。计费单元是用户的单台设备高度,如用户托管多台设备,所需交纳的机位费为每台设备按相应设备高度对应费率所得机位费的累加值。(2)机架费指用户独享IDC提供的一个机架/柜时所需交纳的空间资源占用费。
2.端口通信费
区域分类
|
接入方式
|
端口通信费(元/月)
|
||||
五星级
|
四星级
|
三星级
|
二星级
|
一星级
|
||
AA类地区
|
共享100Mbit/s
|
1500
|
1200
|
1000
|
800
|
600
|
独享10Mbit/s
|
15000
|
12000
|
10000
|
8000
|
6000
|
|
独享50Mbit/s
|
60000
|
48000
|
38000
|
30000
|
24000
|
|
独享100Mbit/s
|
90000
|
72000
|
58000
|
46000
|
37000
|
|
独享1Gbit/s
|
600000
|
480000
|
380000
|
300000
|
240000
|
|
A类地区
|
共享100Mbit/s
|
1200
|
1000
|
800
|
600
|
500
|
独享10Mbit/s
|
12000
|
10000
|
8000
|
6000
|
5000
|
|
独享50Mbit/s
|
48000
|
38000
|
30000
|
24000
|
19000
|
|
独享100Mbit/s
|
72000
|
58000
|
46000
|
37000
|
30000
|
|
独享1Gbit/s
|
480000
|
380000
|
300000
|
240000
|
190000
|
|
B类地区
|
共享100Mbit/s
|
1000
|
800
|
600
|
500
|
400
|
独享10Mbit/s
|
10000
|
8000
|
6000
|
5000
|
4000
|
|
独享50Mbit/s
|
38000
|
30000
|
24000
|
19000
|
15000
|
|
独享100Mbit/s
|
58000
|
46000
|
37000
|
30000
|
24000
|
|
独享1Gbit/s
|
380000
|
300000
|
240000
|
190000
|
150000
|
|
C类地区
|
共享100Mbit/s
|
800
|
600
|
500
|
400
|
300
|
独享10Mbit/s
|
8000
|
6000
|
5000
|
4000
|
3000
|
|
独享50Mbit/s
|
30000
|
24000
|
19000
|
15000
|
12000
|
|
独享100Mbit/s
|
46000
|
37000
|
30000
|
24000
|
19000
|
|
独享1Gbit/s
|
300000
|
240000
|
190000
|
150000
|
120000
|
注:以上资费为中国联通IDC基础业务资费标准,具体项目收费由各省分公司根据本省区域分类和机房星级水平的不同进行方案报价。
rev="post-1173" No comments
– 2011/02/15
Discuz! X1.5 【R20101228】
下载
Discuz!7.2/UCHome2.0/SupeSite7.5 至 Discuz!X1.5正式版 升级教程:
http://www.discuz.net/thread-1887968-1-1.html
nginx rewrite
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;
if (!-e $request_filename) {
return 404;
}
discuz7.2 兼容rewrite
if ($query_string ~* tid=([0-9]+)) {
set $id $1;
rewrite “^(.*)/viewthread.php$” $1/forum.php?mod=viewthread&tid=$id&extra=page%3D&page=1 last;
}
if ($query_string ~* gid=([0-9]+)) {
set $id $1;
rewrite “^(.*)/index.php$” $1/forum.php?gid=$id last;
}
if ($query_string ~* fid=([0-9]+)&filter=type&typeid=([0-9]+)) {
set $id $1;
set $typeid $2;
rewrite “^(.*)/forumdisplay.php$” $1/forum.php?mod=forumdisplay&fid=$id&filter=typeid&typeid=$typeid last;
}
rewrite ^([^\.]*)/archiver/$ $1/forum.php?archiver=1 last;
if ($query_string ~* action=credits) {
rewrite “^(.*)/memcp.php$” $1/home.php?mod=spacecp&ac=credit last;
}
rewrite ^([^\.]*)/attachment.php$ $1/forum.php last;
图片路径修正
cd htdocs/bbs/
ln -s ./static/image ./images
ln -s ./data/attachment/forum ./attachments
Posted in Discuz/Uchome/Ucenter, 其它.
rev="post-1164" No comments
– 2011/01/12
Fatal error: Class ‘PHPExcel_Worksheet’ not found in /htdocs/webapp/includes/libs/PHPExcel.php on line 114
PHPExcel.php第114行内容
$this->_workSheetCollection[] = new PHPExcel_Worksheet($this);
PHPExcel使用了自动载入class
PHPExcel/Autoloader.php 第43行输入调试代码
echo $pObjectFilePath;
var_dump(file_exists($pObjectFilePath));
echo “
“;
if ((file_exists($pObjectFilePath) === false) || (is_readable($pObjectFilePath) === false)) {
return false;
}
/htdocs/webapp/includes/libs/PHPExcel/Shared/ZipStreamWrapper.phpbool(true)
/htdocs/webapp/includes/libs/PHPExcel/Worksheet.phpbool(false)
Fatal error: Class ‘PHPExcel_Worksheet’ not found in /htdocs/webapp/includes/libs/PHPExcel.php on line 114
Worksheet.php文件没有存在?
反复检查了php中open_basedir,文件及目录权限,zip扩展,pear都没问题.
并在autoloader前用代码测试文件确实可以检测到.
var_dump(file_exists(‘/htdocs/webapp/includes/libs/PHPExcel/Worksheet.php’));
试了下把ZipStreamWrapper.php禁止载入后就可顺利通过.
注释PHPExcel.php第34行内容
PHPExcel_Autoloader::Register();
//PHPExcel_Shared_ZipStreamWrapper::register();
看来问题确实在这里,再用代码确认下是stream_register_wrapper和file_exists的bug
class VariableStream {
var $position;
var $varname;
function stream_open($path, $mode, $options, &$opened_path)
{
$url = parse_url($path);
$this->varname = $url[“host”];
$this->position = 0;
return true;
}
function stream_read($count)
{
$ret = substr($GLOBALS[$this->varname], $this->position, $count);
$this->position += strlen($ret);
return $ret;
}
function stream_write($data)
{
$left = substr($GLOBALS[$this->varname], 0, $this->position);
$right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
$GLOBALS[$this->varname] = $left . $data . $right;
$this->position += strlen($data);
return strlen($data);
}
function stream_tell()
{
return $this->position;
}
function stream_eof()
{
return $this->position >= strlen($GLOBALS[$this->varname]);
}
function stream_seek($offset, $whence)
{
switch($whence) {
case SEEK_SET:
if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
$this->position = $offset;
return true;
} else {
return false;
}
break;
case SEEK_CUR:
if ($offset >= 0) {
$this->position += $offset;
return true;
} else {
return false;
}
break;
case SEEK_END:
if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
$this->position = strlen($GLOBALS[$this->varname]) + $offset;
return true;
} else {
return false;
}
break;
default:
return false;
}
}
}
var_dump(file_exists(‘/htdocs/webapp/includes/libs/PHPExcel.php’));
stream_register_wrapper(“var”, “VariableStream”)
or die(“Failed to register protocol”);
var_dump(file_exists(‘/htdocs/webapp/includes/libs/PHPExcel.php’));
输出结果
bool(true) bool(false)
解决方法:
1.注释PHPExcel.php第34行内容
PHPExcel_Shared_ZipStreamWrapper::register();
2.更换php版本
目前换成php.5.2.14没有问题
rev="post-1157" No comments
– 2010/12/23
在access.log中有大量400错误,并以每天几百M的速度增加,占用大量空间.
tail -f /opt/nginx/logs/access.log
116.236.228.180 – – [15/Dec/2010:11:00:15 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:15 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:15 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:15 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:15 +0800] “-” 400 0 “-” “-”
119.97.196.7 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
119.97.196.7 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
219.243.95.197 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
116.236.228.180 – – [15/Dec/2010:11:00:16 +0800] “-” 400 0 “-” “-”
网上大把的文章说是HTTP头/Cookie过大引起的,可以修改nginx.conf中两参数来修正.
client_header_buffer_size 16k;
large_client_header_buffers 4 32k;
修改后
client_header_buffer_size 64k;
large_client_header_buffers 4 64k;
没有效果,就算我把nginx0.7.62升到最新的0.8.54也没能解决.
在官方论坛中nginx作者提到空主机头不会返回自定义的状态码,是返回400错误.
http://forum.nginx.org/read.php?2,9695,11560
最后修正如下
改为原先的值
client_header_buffer_size 16k;
large_client_header_buffers 4 32k;
关闭默认主机的日志记录就可以解决问题
server {
listen *:80 default;
server_name _;
return 444;
access_log off;
}
rev="post-1153" 5 comments
– 2010/12/15
后台添加ip禁止时如果去除有效期保持为空,会造成服务器负载直线上升,数据库大量空连接,网站不能访问.
删险添加的记录并重新生成缓存后可解决问题.
Posted in Discuz/Uchome/Ucenter, 其它.
rev="post-1147" No comments
– 2010/11/29
mysqlreport以非常友好的方式显示MySQL状态变量值。和SHOW STATUS不同,mysqlreport以一种非常格式化的方式输出状态值,具有非常好的可读性。
wget http://hackmysql.com/scripts/mysqlreport-3.5.tgz
tar zxvf mysqlreport-3.5.tgz
cd mysqlreport-3.5
chmod +x mysqlreport
./mysqlreport
Use of uninitialized value in subtraction (-) at ./mysqlreport line 648.
Use of uninitialized value in subtraction (-) at ./mysqlreport line 648.
Use of uninitialized value in multiplication (*) at ./mysqlreport line 648.
Use of uninitialized value in multiplication (*) at ./mysqlreport line 652.
Use of uninitialized value in multiplication (*) at ./mysqlreport line 652.
MySQL 5.1.26-rc uptime 0 2:57:2 Wed Nov 17 14:48:32 2010
__ Key _________________________________________________________________
Buffer used 366.25M of 3.02G %Used: 11.83
Current 944.89M %Usage: 30.52
Write hit 52.83%
Read hit 99.95%
__ Questions ___________________________________________________________
Total 6.76M 636.3/s
DMS 3.34M 314.0/s %Total: 49.35
Com_ 1.92M 180.5/s 28.36
COM_QUIT 823.41k 77.5/s 12.18
QC Hits 684.24k 64.4/s 10.12
-Unknown 978 0.1/s 0.01
Slow 10 s 83 0.0/s 0.00 %DMS: 0.00 Log: OFF
DMS 3.34M 314.0/s 49.35
SELECT 2.47M 232.2/s 36.49 73.94
UPDATE 360.06k 33.9/s 5.33 10.80
INSERT 238.60k 22.5/s 3.53 7.15
DELETE 172.46k 16.2/s 2.55 5.17
REPLACE 97.91k 9.2/s 1.45 2.94
Com_ 1.92M 180.5/s 28.36
set_option 1.12M 105.5/s 16.57
change_db 743.18k 70.0/s 11.00
show_variab 26.44k 2.5/s 0.39
__ SELECT and Sort _____________________________________________________
Scan 90.27k 8.5/s %SELECT: 3.66
Range 94.02k 8.9/s 3.81
Full join 35 0.0/s 0.00
Range check 0 0/s 0.00
Full rng join 0 0/s 0.00
Sort scan 59.49k 5.6/s
Sort range 136.07k 12.8/s
Sort mrg pass 0 0/s
__ Query Cache _________________________________________________________
Memory usage 50.50M of 128.00M %Used: 39.45
Block Fragmnt 24.56%
Hits 684.24k 64.4/s
Inserts 2.39M 224.6/s
Insrt:Prune 2.39M:1 224.6/s
Hit:Insert 0.29:1
__ Table Locks _________________________________________________________
Waited 156.42k 14.7/s %Total: 3.20
Immediate 4.73M 445.4/s
__ Tables ______________________________________________________________
Open 1238 of 3072 %Cache: 40.30
Opened 2.27k 0.2/s
__ Connections _________________________________________________________
Max used 111 of 350 %Max: 31.71
Total 824.31k 77.6/s
__ Created Temp ________________________________________________________
Disk table 29.99k 2.8/s
Table 100.82k 9.5/s Size: 1.0G
File 0 0/s
__ Threads _____________________________________________________________
Running 2 of 4
Cached 76 of 80 %Hit: 99.97
Created 208 0.0/s
Slow 0 0/s
__ Aborted _____________________________________________________________
Clients 1.78k 0.2/s
Connects 42 0.0/s
__ Bytes _______________________________________________________________
Sent 13.50G 1.3M/s
Received 1.08G 101.5k/s
mysql配置信息参照之前的优化
http://blog.c1gstudio.com/archives/1142
rev="post-1144" No comments
– 2010/11/17
安装运行
wget http://www.day32.com/MySQL/tuning-primer.sh
chmod +x tuning-primer.sh
运行时你可以选择在用户目录下生成一个保存mysql密码的.my.cnf文件方便下次调用
~/.my.cnf文件内容应该是这样的
cat ~/.my.cnf
[client]
user=test
password=123qwe
socket=/opt/mysql/mysql.sock
./tuning-primer.sh
Using login values from ~/.my.cnf
– INITIAL LOGIN ATTEMPT FAILED –
Testing for stored webmin passwords:
None Found
Could not auto detect login info!
Found Sockets: /opt/mysql/mysql.sock
Using: /opt/mysql/mysql.sock
Would you like to provide a different socket?: [y/N] n
Do you have your login handy ? [y/N] : y
User: test
Password: 123qwe
Would you like me to create a ~/.my.cnf file for you? [y/N] : y
~/.my.cnf already exists!
Replace ? [y/N] : y
– FINAL LOGIN ATTEMPT FAILED –
Unable to log into socket: /opt/mysql/mysql.sock
因为我的mysql是编译安装在/opt/mysql/下,这里找不到执行文件,所以没有连接上.
编辑第219和220行,手动修改文件加上路径
vi tuning-primer.sh
215 if [ -f /etc/psa/.psa.shadow ] ; then
216 mysql=”mysql -S $socket -u admin -p$(cat /etc/psa/.psa.shadow)”
217 mysqladmin=”mysqladmin -S $socket -u admin -p$(cat /etc/psa/.psa.shadow)”
218 else
219 mysql=”/opt/mysql/bin/mysql”
220 mysqladmin=”/opt/mysql/bin/mysqladmin”
221 # mysql=”mysql -S $socket”
222 # mysqladmin=”mysqladmin -S $socket”
223 fi
顺带修复生成密码时的错误问题.
第313行”$pass\”后面需加个”n”
313 printf “[client]\nuser=$user\npassword=$pass\nsocket=$socket” > ~/.my.cnf
提示:vi中显示行号方法.在命令模式下输入”:set number”
保存后再次运行,在终端上按照问题重要程度分别用黄色/红色字符标记问题
./tuning-primer.sh
— MYSQL PERFORMANCE TUNING PRIMER —
– By: Matthew Montgomery –
MySQL Version 5.1.26-rc x86_64
Uptime = 0 days 7 hrs 17 min 18 sec
Avg. qps = 286
Total Questions = 7527430
Threads Connected = 6
Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations
To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL’s Enterprise Monitoring and Advisory Service
SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 29 out of 7527516 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine
BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.1/en/point-in-time-recovery.html
WORKER THREADS
Current thread_cache_size = 80
Current threads_cached = 75
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 350
Current threads_connected = 7
Historic max_used_connections = 208
The number of used connections is 59% of the configured maximum.
Your max_connections variable seems to be fine.
No InnoDB Support Enabled!
MEMORY USAGE
Max Memory Ever Allocated : 68.78 G
Configured Max Per-thread Buffers : 112.17 G
Configured Max Global Buffers : 2.12 G
Configured Max Memory Limit : 114.29 G
Physical Memory : 15.66 G
nMax memory limit exceeds 90% of physical memory
KEY BUFFER
Current MyISAM index space = 3.00 G
Current key_buffer_size = 2.00 G
Key cache miss rate is 1 : 3262
Key buffer free ratio = 62 %
Your key_buffer_size seems to be fine
QUERY CACHE
Query cache is enabled
Current query_cache_size = 128 M
Current query_cache_used = 61 M
Current query_cache_limit = 2 M
Current Query cache Memory fill ratio = 47.81 %
Current query_cache_min_res_unit = 2 K
Query Cache is 21 % fragmented
Run “FLUSH QUERY CACHE” periodically to defragment the query cache memory
If you have many small queries lower ‘query_cache_min_res_unit’ to reduce fragmentation.
MySQL won’t cache query results that are larger than query_cache_limit in size
SORT OPERATIONS
Current sort_buffer_size = 256 M
Current read_rnd_buffer_size = 32 M
Sort buffer seems to be fine
JOINS
Current join_buffer_size = 32.00 M
You have had 15 queries where a join could not use an index properly
join_buffer_size >= 4 M
This is not advised
You should enable “log-queries-not-using-indexes”
Then look for non indexed joins in the slow query log.
OPEN FILES LIMIT
Current open_files_limit = 51200 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine
TABLE CACHE
Current table_open_cache = 3072 tables
Current table_definition_cache = 256 tables
You have a total of 658 tables
You have 1814 open tables.
The table_cache value seems to be fine
You should probably increase your table_definition_cache value.
TEMP TABLES
Current max_heap_table_size = 384 M
Current tmp_table_size = 1.00 G
Of 142450 temp tables, 18% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine
TABLE SCANS
Current read_buffer_size = 8 M
Current table scan ratio = 5065 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 1 : 25
You may benefit from selective use of InnoDB.
If you have long running SELECT’s against MyISAM tables and perform
frequent updates consider setting ‘low_priority_updates=1’
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting ‘concurrent_insert=2’.
我的my.cnf
[mysqld]
port = 3306
socket = /opt/mysql/mysql.sock
skip-locking
skip-name-resolve
back_log=100
key_buffer_size = 2048M
query_cache_size = 128M
query_cache_limit = 2M #default=1M
query_cache_min_res_unit = 2k #default=4K
max_allowed_packet = 16M
table_cache = 3072
tmp_table_size = 1024M #default=16M
max_heap_table_size = 384M #default=16M
read_buffer_size = 8M
read_rnd_buffer_size = 32M
sort_buffer_size = 256M
join_buffer_size = 32M
myisam_sort_buffer_size = 256M
thread_cache_size = 80 #default=0
thread_stack = 192K #default=192K
# Try number of CPU’s*2 for thread_concurrency
thread_concurrency = 16 #default=10
connect_timeout = 30
#interactive timeout = 600
max_connection = 350
max_connect_errors = 30
wait_timeout = 30
服务配置为5504(4核) *2,16G内存,centos 5.3 64位
大大小小十几个数据库,几十G数据,主要的应用是discuz论坛
根据提示对my.cnf做一些优化,效率更好了点.
关键还是需要优化sql来减少慢查询及锁定的问题.
key_buffer_size = 3096M
table_definition_cache = 800
join_buffer_size = 4M
low_priority_updates =1
参考:http://www.chedong.com/blog/archives/001451.html
rev="post-1142" No comments
– 2010/11/17
由于TinyMce编辑器的内容不能用js直接获取,否则获取的永远是初始化时候的值,必须使用它们内部提供的函数。
函数如下:
来源:
http://www.ourys.com/?s=tinymce
rev="post-1140" No comments
– 2010/11/10
$testarr = array(‘a’,’b’,’c’);
foreach( $testarr as $k=>&$v ) {
echo $k.”=>”.$v.”
“;
}
echo “——-
“;
foreach( $testarr as $k=>$v ) {
echo $k.”=>”.$v.”
“;
}
你可能以为结果为
0=>a
1=>b
2=>c
——-
0=>a
1=>b
2=>c
实际输出是
0=>a
1=>b
2=>c
——-
0=>a
1=>b
2=>b
这是什么道理?
rev="post-1129" 1 comment
– 2010/10/20
近期评论