net use与shutdown配合使用,本机重启远程服务器
- Published in Windows 7
webmin ssl
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.
卸载 chrome
来到
C:\Users\XXXXXXXXXX\AppData\Local\Google\
删除 Google\
重装 chrome
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.deb
then run the command :dpkg --install webmin_1.600_all.deb
The 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 python
If 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.
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
You should also fetch and install my GPG key with which the repository is signed, with the commands :
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contribcd /root
You will now be able to install with the commands :
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.ascapt-get update
All dependencies should be resolved automatically.
apt-get install webmin
Webmin has been tested on all regular Debian releases, Ubuntu Linux, and derivatives like Xandros and APLINUX.
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 .
http://www.eclipse.org/babel/downloads.php
下载
解压缩
1:在eclipse 上面 help ------install new software ---add
2:在弹出的对话框上写上名称:点 local 选择 解压 目录
3:选择安装包
4: next
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
每打开一个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
# mysqlcheck -A -o -r -p