net use与shutdown配合使用,本机重启远程服务器

 

通过shutdown命令远程重启服务器的方法。
仔细想了想,又在网上找了相关的资料。通过如下两条命令,解决此问题。
  net use \\192.168.0.10 123456/user:administrator
  shutdown -r -m \\192.168.0.10 –t 0
  其中要先执行第一条命令,执行该命令后,我们便给服务器的administrator用户授予了远程重启的权限。
  然后我们在执行第二条命令,就可以在本机重启远程的服务器了。
 
PS:一、我们在使用上述两条命令时,请注意中间的空格,否则在使用过程中系统会提示相关的错误信息
  二、其实通过上述的命令我们还可以远程关机,只要我们把第二条命令稍微修改一下即可。关机命令如下:
shutdown -s -m \\192.168.0.10 –t 0
  三、使用此命令中的第一条时,必须要知道服务器上管理员帐户和密码
Read more...

Seagate ST3000DM001 3TB drives...chirping and clicking

Hi,

I am using a QNAP TS-659 PROII and it's fantasitc. I have five 3TB Seagate ST3000DM001-9YN1CC4B drives and they all click, spin down and spin up constantly every 20 seconds or so. Most of you would know that this is the head parking and the drive spinning down. This is called a 'load cycle' and the drives are only rated for about 300,000 of them. Some people are reporting a lot of load cycles so not only are they noising and annoying but they're also putting mechanical stress on the drives.

I have updated my QNAP to run a script when it boots and this has solved the spin down/up problem. No more clicking or chirping and it's been running for days now!!!

(see note below about drive names if you're running a different system)


Here's how you do it:

1 - download PuTTY from this link:

http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

...this allows you to log in to your QNAP to type commands.

2 - run PuTTY

3 - when it asks for a Host Name (or IP address) enter the address of your QNAP. If you don't know
what it is press the button on the front of the NAS and note its number. Mine is set to:

192.168.0.100

...now press Open.

4 - When it says: "Login as:" type in your NAS login. You generally type in "admin" or your login name if it's different.

5 - Do the same for password. Type in "admin" if you have not changed your password.

6 - Type this in and press enter:
(you can cut and paste this text from this document and when in PuTTY right-click to paste it in. Better than typing!)

mount -t ext2 /dev/sdx6 /tmp/config

7 - Type this in and press enter:

vi /tmp/config/autorun.sh

This opens a text editor called "vi"

8 - Now press "a" to add text and enter the following lines and press enter after each line:

#!/bin/sh
hdparm -B 255 /dev/sda3
hdparm -B 255 /dev/sdb3
hdparm -B 255 /dev/sdc3
hdparm -B 255 /dev/sdd3
hdparm -B 255 /dev/sde3


9 - Now press ESC to exit edit mode

10 - Now press "ZZ". These are capital ZZ so hold down shift when you do it. The text editor is now
closed and has saved a file called autorun.sh for you.

11 - Type this in and press enter:

chmod +x /tmp/config/autorun.sh

12 - Type this in and press enter:

umount /tmp/config

13 - Now close the Windows Software PuTTY.

14 - Turn off your QNAP and turn it on again.

Your drives will no longer spin down and spin up making horrible clicking noises. You will not need
to do this again as autorun.sh is exectued each time you start your NAS.

Great success!!

NOTE: Your NAS may be different from my RAID5 NAS and you may need to change the "/sda" text to
something else. To see what your QNAP is using start PuTTY again and enter the following command:

mdadm --detail /dev/md0

This will display information about your drive. At the end you'll see something like this:

Number Major Minor RaidDevice State
0 8 3 0 active sync /dev/sda3
1 8 19 1 active sync /dev/sdb3
2 8 35 2 active sync /dev/sdc3
3 8 51 3 active sync /dev/sdd3
4 8 67 4 active sync /dev/sde3

Note the /sda3 /sdb3 etc. These are the names of your disk drive. You should change your autorun.sh
to whatever your system says when editing your text file.

Read more...

Installing WEBMIN on Debian

If you are using the DEB version of webmin, first download the file from thedownloads page , or run the command :wget http://prdownloads.sourceforge.net/webadmin/webmin_1.600_all.debthen run the command :dpkg --install webmin_1.600_all.debThe install will be done automatically to /usr/share/webmin, the administration username set to root and the password to your current root password. You should now be able to login to Webmin at the URL http://localhost:10000/. Or if accessing it remotely, replace localhost with your system's IP address.

If Debian complains about missing dependencies, you can install them with the command :apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions pythonIf you are installing on Ubuntu and the apt-get command reports that some of the packages cannot be found, edit /etc/apt/sources.list and make sure the lines ending with universe are not commented out.

Some Debian-based distributions (Ubuntu in particular) don't allow logins by theroot user by default. However, the user created at system installation time can usesudo to switch to root. Webmin will allow any user who has this sudo capability to login with full root privileges.

If you want to connect from a remote server and your system has a firewall installed, see this page for instructions on how to open up port 10000.

Using the Webmin APT repository

If you like to install and update Webmin via APT, edit the /etc/apt/sources.list file on your system and add the lines :deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
You should also fetch and install my GPG key with which the repository is signed, with the commands :cd /root
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
You will now be able to install with the commands :apt-get update
apt-get install webmin
All dependencies should be resolved automatically.

Supported Debian-based Distributions

Webmin has been tested on all regular Debian releases, Ubuntu Linux, and derivatives like Xandros and APLINUX.

Source Packages

The files needed to build the Debian package are deb/webmin_1.600.dsc,deb/webmin_1.600.diff, and webmin-1.600.tar.gz .

Read more...

[ERROR] /usr/libexec/mysqld: Can't open file: './xxx/xxxxxxxxx.frm' (errno: 24)

my.cnf

innodb_open_files=1024

open_files_limit=5000

 

 

 mysql -uroot -pXXXXX

 

1,显示当前系统的文件限制
# cat /proc/sys/fs/file-max
调整参考:http://hi.baidu.com/loveyoursmile/blog/item/e26b550fed89ff226059f3c4.html

2,通过phpmyadmin查询mysql配置参数(既open files limit)。
一般情况下,mysql 5的open files limit会自动根据table cache调整。open files limit 系统默认调整为table cache的2倍多一点。

 

 

I go the following errors in a database:

091030 0:23:46 [ERROR] /usr/sbin/mysqld-max: Can't open file: './register/member.frm' (errno: 24)
091030 0:23:46 [ERROR] /usr/sbin/mysqld-max: Can't open file: './register/description.frm' (errno: 24)

This is related to file descriptors.

# perror 24
OS error code  24:  Too many open files

I enlarge the value of open_files_limit by adding a line in my.cnf.

open_files_limit=5000

For open_files_limit, please refer this link:

http://cherry.world.edoors.com/CozM0IXYA-fc

For more explanation about this error, please refer this page:

B.5.2.18. 'File' Not Found and Similar Errors
http://dev.mysql.com/doc/refman/5.0/en/not-enough-file-handles.html

 

 

how to calculate open file limit?
(发表日期: 2009-8-23 11:39am, 总访问量: 1412, 今天访问: 1, 本周访问: 6, 本月访问: 19)

每打开一个MyISAM表,就需要使用2个文件描述符,咱们来验证一下MySQL如何计算打开文件数。

一、试验
从手册的"6.4.8. How MySQL Opens and Closes Tables"可以了解到,每打开一个MyISAM表,就需要使用2个文件描述符,咱们来验证一下。
1. 重启mysqld
/etc/init.d/mysql restart
2. 看看打开了几个文件
lsof | grep /home/mysql 
... 
mysqld 24349 mysql 5u unix 0x000001041e8de040 4244009 /home/mysql/mysql.sock 
mysqld 24349 mysql 6u REG 8,33 2048 30425188 /home/mysql/mysql/host.MYI 
mysqld 24349 mysql 7u REG 8,33 0 30425189 /home/mysql/mysql/host.MYD 
mysqld 24349 mysql 8u REG 8,33 2048 30425153 /home/mysql/mysql/user.MYI 
mysqld 24349 mysql 9u REG 8,33 892 30425155 /home/mysql/mysql/user.MYD 
mysqld 24349 mysql 10u REG 8,33 5120 30425126 /home/mysql/mysql/db.MYI 
mysqld 24349 mysql 11u REG 8,33 3080 30425148 /home/mysql/mysql/db.MYD 
mysqld 24349 mysql 12u REG 8,33 4096 30425154 /home/mysql/mysql/tables_priv.MYI 
mysqld 24349 mysql 13u REG 8,33 0 30425157 /home/mysql/mysql/tables_priv.MYD 
mysqld 24349 mysql 14u REG 8,33 4096 30425143 /home/mysql/mysql/columns_priv.MYI 
mysqld 24349 mysql 15u REG 8,33 0 30425156 /home/mysql/mysql/columns_priv.MYD 
mysqld 24349 mysql 16u REG 8,33 4096 30425127 /home/mysql/mysql/procs_priv.MYI 
mysqld 24349 mysql 17u REG 8,33 0 30425136 /home/mysql/mysql/procs_priv.MYD 
mysqld 24349 mysql 18u REG 8,33 1024 30425173 /home/mysql/mysql/servers.MYI 
mysqld 24349 mysql 19u REG 8,33 0 30425174 /home/mysql/mysql/servers.MYD 
mysqld 24349 mysql 20u REG 8,33 2048 30425182 /home/mysql/mysql/event.MYI 
mysqld 24349 mysql 21u REG 8,33 0 30425183 /home/mysql/mysql/event.MYD 
...    

可以看到,总共打开了8个表,每个表分别有2个文件描述符,看来没错。 

3. 再来看 status 结果 

mysql>show global status like 'open_%'; 
+------------------------+-------+ 
| Variable_name | Value | 
+------------------------+-------+ 
| Open_files | 17 | 
| Open_streams | 0 | 
| Open_table_definitions | 15 | 
| Open_tables | 8 | 
| Opened_files | 52 | 
| Opened_tables | 15 | 
+------------------------+-------+ 

4. flush tables 后再看看
mysql>flush tables; 
mysql> show global status like 'open_%'; 
+------------------------+-------+ 
| Variable_name | Value | 
+------------------------+-------+ 
| Open_files | 1 | 
| Open_streams | 0 | 
| Open_table_definitions | 0 | 
| Open_tables | 0 | 
| Opened_files | 52 | 
| Opened_tables | 15 | 
+------------------------+-------+ 
lsof | grep /home/mysql 
... 
mysqld 24349 mysql 5u unix 0x000001041e8de040 4244009 /home/mysql/mysql.sock 
mysqld 24349 mysql 22u unix 0x00000102378ff980 4244128 /home/mysql/mysql.sock 
... 

可以看到,flush 之后,所有的文件描述符都释放了。
通过测试可以得知,另一个打开的文件描述符是 slow query log所用。
如果是有大量的 MyISAM 表,那么就需要特别注意打开文件数是否会超出限制了。 

二、原理

接下来仔细了解下这个最大文件数相关的参数:
table_cache (新版本改成了 table_open_cache) The number of cached open tables.
open_files_limit If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit().
If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger)
number of files.
如果 open_files_limit 不是设置为 0,则以 setrlimit() 函数计算后的结果为准,如果设置为 0,则实际值是 max_connections*5 或 max_connections + table_cache*2 中的最大者。
因此,想要解决打开文件数超限的问题,还需要综合系统内核限制(ulimit -n),mysqld自身限制(open_files_limit),以及表缓存数(table_open_cache)等多方面因素。
不过,实际测试中,发现却不是这样的,open_files_limit采用了内核的最大限制,而非上面的计算结果。
1. 查看内核限制
ulimit -n
65535
2. 修改 my.cnf 限制
vi /etc/my.cnf 
... 
open_files_limit = 10000 
... 

3. 重启 mysqld
/etc/init.d/mysql restart
4. 查看结果
mysql>show global variables like '%open%'; 
| open_files_limit | 65535 | 
| table_open_cache | 1000 | 

5. 不设置 open_files_limit 看看
vi /etc/my.cnf 
... 
#open_files_limit = 10000 
... 
重启 
/etc/init.d/mysql restart 
查看 
mysql>show global variables like '%open%'; 
| open_files_limit | 65535 | 
| table_open_cache | 1000 | 

而这个时候,按计算公式结果如下:
| max_connections | 100 |
| table_open_cache | 1000 |
来计算一下:
max_open_files_1 = max_connections + table_cache * 2 = 100 + 1000 * 2 = 2100
max_open_files_2 = max_connections*5 = 100 * 5 = 500
6. 修改 ulimit 试试看:
unlimit -n 5000 
vi /etc/my.cnf 
... 
open_files_limit = 10000 
... 
/etc/init.d/mysql restart 
mysql>show global variables like '%open%'; 
| open_files_limit | 10000 | 
| table_open_cache | 1000 | 

open_files_limit 比内核最大限制数还大,因此以 open_files_limit 为准。 
vi /etc/my.cnf 
... 
#open_files_limit = 10000 
... 
/etc/init.d/mysql restart 
mysql>show global variables like '%open%'; 
| open_files_limit | 5000 | 
| table_open_cache | 1000 | 

看到了,变成了新的内核最大限制
看到了吧,结果完全跟文档描述的以及mysql源码中写的不一样,看来预编译版本有些地方不太可靠啊 :(
以上测试在mysql 5.1.23-rc(预编译), mysql-5.1.24-rc(自编译) 以及 5.0.45(预编译) 均一样。
uname -a 
Linux s1.yejr.com 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux 
mysql> select version(); 
+---------------+ 
| version() | 
+---------------+ 
| 5.1.23-rc-log | 
+---------------+ 

转载自 http://bbs.bbsgood.com/post_20_123433_1.html

Read more...
Subscribe to this RSS feed
Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 2 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 3 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php on line 191

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 2 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 3 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34