1and1 server London zoneinfo is invalid

I can not believe it! One of the files come with 1and1 CentOS server installation is invalid. I do not know whether other types of servers from 1and1 have the same situation, but I am using 1and1 cloud server 64bit. The damaged file is /usr/share/zoneinfo/Europe/London. Every method I tried to set timezone to London (for now it is BST: British Summer Time), the system resets it to EDT: Eastern Daylight Time.

Normally I know how to set timezone on server, but cloud server is new to me. So when I see my methods do not work, my first reaction is looking for some secret method that works on cloud server. I have tried different ways to set timezone before I ever think about the London zoneinfo file is invalid. In a total hopelessness, I upload my PC’s /usr/share/zoneinfo/Europe/London from Fedora to CentOS, and it works.

Other zoneinfo files are OK as I observed.

Demystify 1and1 cloud server

漫天都是“云服务”,但真让我有云的感觉的服务目前只有 Google 一家。最近买了 1&1 cloud server,如果要评满意程度的话,只能是 5 out of 10 (购前期望过高)。

我原以为基于云的服务器可以一劳永逸、无限扩张,哪知 1&1 cloud server cpu core, memory, hard disk 都有上限,cpu core 最多买 4 个,其实就相当于单个 quad core cpu。

1&1 cloud server 性能也一般,或许还不如 vps,唯一优势就是比同等性能的 dedicated server 便宜一些。

hardware-configuration-page-1

Picture 1 of 5

1and1 cloud server datasheet

从 1&1 新订了一个合同,cloud server,就是为了让 magento 跑快一些。那 1and1 的 cloud server 究竟能有多快呢?

先看看 cat /proc/cpuinfo 的情况
processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2352
stepping : 3
cpu MHz : 2109.718
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush mmx fxsr sse sse2 syscall mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 popcnt lahf_lm cr8_legacy altmovcr8 abm sse4a misalignsse
bogomips : 4219.43
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2352
stepping : 3
cpu MHz : 2109.718
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush mmx fxsr sse sse2 syscall mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 popcnt lahf_lm cr8_legacy altmovcr8 abm sse4a misalignsse
bogomips : 4220.53
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management:

processor : 2
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2352
stepping : 3
cpu MHz : 2109.718
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush mmx fxsr sse sse2 syscall mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 popcnt lahf_lm cr8_legacy altmovcr8 abm sse4a misalignsse
bogomips : 4223.97
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management:

processor : 3
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2352
stepping : 3
cpu MHz : 2109.718
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush mmx fxsr sse sse2 syscall mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 popcnt lahf_lm cr8_legacy altmovcr8 abm sse4a misalignsse
bogomips : 4219.25
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management:

在 cloud server 上我使用 zend server。我特意从 1 Virtual processor core 1GB Ram 一步步往上加,使用 ab -c 5 -n 500 对比测试,客户端是 10 Mb down stream / 1Mb up stream adsl 连接。

在 1 Virtual processor core 1GB Ram 时,Requests per second: 5.31 [#/sec]
在 2 Virtual processor cores 1GB Ram 时,Requests per second: 8.34 [#/sec]
在 2 Virtual processor cores 2GB Ram 时,Requests per second: 8.26 [#/sec]
在 3 Virtual processor cores 1GB Ram 时,Requests per second: 10.57 [#/sec]
在 4 Virtual processor cores 1GB Ram 时,Requests per second: 11.33 [#/sec]

在 shopping cart 里有 7 条不同商品时,checkout/cart/index 页面时间为 10 秒左右。

回头看看老 server
# cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 67
model name : Dual-Core AMD Opteron(tm) Processor 1216 HE
stepping : 3
cpu MHz : 1000.000
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
bogomips : 1999.96
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc

processor : 1
vendor_id : AuthenticAMD
cpu family : 15
model : 67
model name : Dual-Core AMD Opteron(tm) Processor 1216 HE
stepping : 3
cpu MHz : 1000.000
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
bogomips : 1999.96
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc

运行的是 nginx,同等条件下,Requests per second: 8.12 [#/sec],checkout/cart/index 页面生成时间也是 10 秒左右。

虽 zend server 和 nginx 不同,靠不是完全对等的对比结果,我还是可以得出两个结论:

  1. 瓶颈仍是 cpu 速度;
  2. cloud server 并未显著提高速度,我对它预期过高,略有失望。

1and1 waste me two days

订了一个 1&1 Cloud Server,两天了还没法用。在 1&1 control panel 里一点那个 cloud server,就抛给我一个 500 Internal Server Error。这是在 1&1 control panel 里的错误,不是我订的 cloud server 上的错误。

一开始我还以为下订单时某个环节没做到,我拼命发 email,拼命打电话(电话很长时间才有人接,接了也会被掐,还是email support 好一些),辗转了 N 个来回以后被告知,1&1 的程序有个错误,让我耐心等。晕啊,浪费我两天时间。

My third DNS server down for a month

今年初,我退掉了 godaddy vps,把原来 godaddy vps 担当的辅助 DNS 角色转给了 1&1 server,却忘了开 1&1 server firewall port (硬件防火墙那道关)。

今天才发现这台辅助 DNS 在过去的一个月根本无法执行 DNS 解析(因为我设置了三台 DNS,挂了一台没引起警觉)。难怪最近 webceo 给我的评分只有 5 分上下,google 的排名也有下降。

赶紧打开防火墙,希望分数能上去。

Connection speed of sourceforge

Connection speed of the Godaddy server is generally slower than the 1&1 server. It was test proven from Europe and China. However, when connecting to downloads.sourceforge.net, Godaddy is faster.

The Godaddy server automatically chooses the mirror site softlayer.dl.sourceforge.net, and the average speed is 8.55M/s. The 1&1 server chooses dfn.dl.sourceforge.net, and the speed is 70K/s. When I force the 1&1 server to download from softlayer.dl.sourceforge.net, the speed does not improve. It is slower even than I download from my PC via ADSL.

I do not know why there is such a big difference in connection speed from different locations.

Tough Parallels Plesk

Parallels Plesk 对我来说是鸡肋。1&1 送了这玩意一年的许用证,一年以后我还用 1&1 吗?我如果用了 Parallels Plesk 就怕象吃鸦片上瘾,以后如果离开 1&1,别人家如果不送 Parallels Plesk 就要花钱买,那时我会觉得很懊恼。

1&1 既然送了 Parallels Plesk,我也在 Parallels Plesk Panel 里转了一圈,觉得它算是一款好的商业软件,只不过不对我的胃口罢了。正因为如此,我没删 Parallels Plesk,只是将 psa service 停止了。

如此相安无事过了几个星期,今天突然发现 opentaps 不能启动了。一查,8443 端口被占用了,我马上想到是 Parallels Plesk 又复活了,难道 psa 还有一个守护进程?Parallels Plesk 这么设计大概为了保证 Panel 的 up time,但有点病毒作风,再加我也搞不清它的机理,看来要把它删了一了百了。

Mount FTP file system on CentOS

有了 SFTP 以后,FTP 几乎没有用武之地了,研究 FTP 大多是因为某些软件或服务器只支持 FTP。

1&1 独立主机附赠一个跟硬盘容量相等的 FTP 备份空间,此 FTP 只能由 root server 访问,但 1&1 并没有提供现成的备份软件(1&1 营销上的失误)。FTP 备份空间对我来说用处不大,但 250 G 的空间空着也是浪费,于是我自创了我的备份方案,此中关键点是如何在 CentOS 上加载 FTP 文件系统。

经一番搜索,找到 curlftpfs,用它可以加载 FTP 文件系统,但 Fedora 可以直接 yum install curlftpfs,CentOS 里没有,得用 DAG repository,所以第一步:安装 DAG repository。

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

第二步:安装 curlftpfs

yum install curlftpfs

第三步:没有第三步,已经可以使用 curlftps 了。如果要加载 FTP 文件系统

curlftpfs ftp://ftp_host/sub_dir mount_point -o user="ftp_username:ftp_password", uid=user_id, gid=group_id, allow_other

如果在启动时自动加载 FTP 文件系统,在 /etc/fstab 中添加一行

curlftpfs#ftp_uername:ftp_password@ftp_host/sub_dir mount_point fuse rw,uid=user_id, gid=group_id,user,allow_other 0 0
(很多关于 curlftpfs in fstab 的介绍使用了 noauto,这样的话,还需执行 mount mount_point 才能真正加载)

卸载 FTP 文件系统

fusermount -u mount_point

Preinstalled package groups of a hosting server

Godaddy CentOS:

Installed Groups:
MySQL Database
Editors
System Tools
Text-based Internet
Legacy Network Server
DNS Name Server
FTP Server
Network Servers
Web Server
Windows File Server
Mail Server
PostgreSQL Database
Yum Utilities

1&1 CentOS:

Installed Groups:
DNS Name Server
Editors
Legacy Network Server
Legacy Software Development
Legacy Software Support
Mail Server
MySQL Database
PostgreSQL Database
System Tools
Text-based Internet
Web Server
Yum Utilities

Finetune 1and1 dedicated server with CentOS

Although the start with 1&1 was not pleasant, I decided to stay with 1&1 and upgraded from a VPS to a dedicated server. (sadly, this VPS performance is much better than the dedicated server I got.) Now it is time to finetune it. The server came with CentOS, which is not my favourite, but it the best OS I can choose from the list.

The first thing to do is

yum update

I am using Ngnix instead of Apache, so turn off pre-installed Apache. Better to do it as the first thing, as I did not aware that httpd is running which prevented nginx from starting and wasted a lot of time to find the reason.
service httpd stop
chkconfig --level 235 httpd off

CentOS depository is missing lots of packages. I add two 3rd party repositories, epel (to get Nignx) and remi (to get the newest php 5.2.9).
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-3.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/5/remi/x86_64/remi-release-5-7.el5.remi.noarch.rpm

Because I use try_files directive quite often in nginx conf files, but try_files starts from nginx 0.6.36, I can not use nginx 0.6.35 in epel repository. Luckly, epel-testing repository has nginx 0.6.36.
yum install nginx --enablerepo=epel-testing

The following commands are straight-forward.
yum install memcached
chkconfig --level 235 memcached on

yum install php-pecl-apc
yum install phpMyAdmin
yum install spawn-fcgi

I encounted difficulty install vim. First try is using yum install vim. It works on other CentOS I installed, aslo works with CentOS on 1&1 VPS, but just does not work on this 1&1 dedicated server. I do not know why. Nevertheless, the below listed command works.
yum install vim-enhanced

Because magento requires php 5.2.0 or above, but CentOS current php version is 5.1.6, it must be updated.
yum update php --enablerepo=remi

I saw some file conflicts from some mysql packages. To solve this problem,
cd /var/cache/yum/remi/packages
rpm -Uvh --force mysql<tab>

<tab> will automatically fill in the package file name.

mysql was up and running, but 1&1 did not tell me how to log into it. It took me a couple of hours to try different combinations of possible usernames and passwords before I gave up. Then I stopped mysqld, restarted it with
mysqld_safe --skip-grant-tables

Then I could go to user table in mysql database to reset root password. However, I found root as a username was not there. Instead, it is admin with all privileges.

So, I quitted mysql, restarted it in a normal way, tried to put in admin as username and the same password as server root user, it worked!

I changed the owner of php session directory (/var/lib/php/session) from apache to nginx, otherwise php could not start session without errors.

I expected the server would work by now, but it did not. It took me another hour to find out it was because php.ini of 1&1 dedicated server had
safe_mode default on

Just turn safe_mode off, because I do not need it. Now my lovely server is fully up.