作者: admin
-
CentOS7和之前版本差别(部分)
一、CentOS的Services使用了systemd来代替sysvinit管理
#查看正在运行的服务
#启动,停止,重启服务
#查看一个服务的状态
#开机时关闭一个服务
#查看服务是否开机启动
例:开机启动sshd服务
启动一个服务:systemctl start postfix.service
说明:启用服务就是在当前“runlevel”的配置文件目录/etc/systemd/system/multi-user.target.wants/里,建立/usr/lib/systemd/system里面对应服务配置文件的软链接;禁用服务就是删除此软链接。
1、systemd使用比sysvinit的运行级更为自由的target替代。第3运行级用multi-user.target替代。第5运行级用graphical.target替代。runlevel3.target和runlevel5.target分别是指向 multi-user.target和graphical.target的符号链接。
2、如何改变默认运行级别?
3、如何查看当前运行级别?
1、setup和ntsysv工具还是保留了,但是功能已大大减弱,以前ntsysv工具可以控制所有系统服务的自启动,现在只能控制少部分服务。
附:systemd简介
-
Centos7 yum安装nginx
安装准备依赖lib库
yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel安装Nginx
安装之前,检查一下是否已经安装有nginxfind -name nginx
如果系统已经安装了nginx,那么就先卸载
yum remove nginx
yum安装nginx
新建
/etc/yum.repos.d/nginx.repo
添加以下,以centos7为例[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/rhel/7/$basearch/
gpgcheck=0
enabled=1rpm –import http://nginx.org/keys/nginx_signing.key
yum install nginx
/bin/systemctl status nginx.service -
CentOS7下root登录桌面
编辑/etc/gdm/custom.conf,修改或者添加以下两行:
AutomaticLoginEnable=true 这个修改为 true
AutomaticLogin=root 这个修改为 root#####################################
# GDM configuration storage[daemon]
AutomaticLoginEnable=true
AutomaticLogin=root
[security][xdmcp]
[greeter]
[chooser]
[debug]
#####################################
登录到桌面时,不要直接点击用户名,而是选择“not list”,然后输入root,输入密码即可进入。
-
Ubuntu的crontab命令
想要让cron执行你指定的任务,首先就要编辑crontab文件。crontab是一个文本文件,用来存放你要运行的命令。你可以以下命令
crontab -e
来打开你的用户所属的crontab文件。第一次用这个命令,会让你选择文本编辑器,我选的是vim。选定的编辑器也可以使用
select-editor
命令来更改。这点命令行中已经有足够的提示,就不多说了。
打开后的crontab文件类似这种样子:
- # m h dom mon dow command
- */2 * * * * date >> ~/time.log
第二行是我为了测试写的一个定期任务,它的意思是,每隔两分钟就执行 date >> ~/time.log 命令(记录当前时间到time.log文件)。你可以把它加入你的crontab中,然后保存退出。
保存了crontab之后,我们还需要重启cron来应用这个计划任务。使用以下命令:
- sudo service cron restart
下面稍微解释下crontab中每行的含义。crontab中的每一行代表一个定期执行的任务,分为6个部分。前5个部分表示何时执行命令,最后一 个部分表示执行的命令。每个部分以空格分隔,除了最后一个部分(命令)可以在内部使用空格之外,其他部分都不能使用空格。前5个部分分别代表:分钟,小 时,天,月,星期,每个部分的取值范围如下:
分钟 0 – 59
小时 0 – 23
天 1 – 31
月 1 – 12
星期 0 – 6 0表示星期天
除了这些固定值外,还可以配合星号(*),逗号(,),和斜线(/)来表示一些其他的含义:
星号 表示任意值,比如在小时部分填写 * 代表任意小时(每小时)
逗号 可以允许在一个部分中填写多个值,比如在分钟部分填写 1,3 表示一分钟或三分钟
斜线 一般配合 * 使用,代表每隔多长时间,比如在小时部分填写 */2 代表每隔两分钟。所以 */1 和 * 没有区别
*/2 可以看成是能被2整除的任意值。
以下是一些例子(省略了命令部分):
- * * * * * # 每隔一分钟执行一次任务
- 0 * * * * # 每小时的0点执行一次任务,比如6:00,10:00
- 6,10 * 2 * * # 每个月2号,每小时的6分和10分执行一次任务
- */3,*/5 * * * * # 每隔3分钟或5分钟执行一次任务,比如10:03,10:05,10:06
以上就是在cron中加入计划任务的基本知识。因为cron中的任务基本就是执行命令行,所以当然也会有权限问题。以上例子中的任务就是以你当前登录用户的权限执行的,如果你需要以root用户执行某个任务,可以在crontab前加上sudo。
- sudo crontab -e
顺带一提,crontab文件对每个用户都是不同的,所以刚才设置的定期看时间的任务,在这里是看不到的。因为我们没有为root用户增加这样的计划任务。
原文
https://help.ubuntu.com/community/CronHowto
Introduction
Cron is a system daemon used to execute desired tasks (in the background) at designated times.
A crontab is a simple text file with a list of commands meant to be run at specified times. It is edited with a command-line utility. These commands (and their run times) are then controlled by the cron daemon, which executes them in the system background. Each user has a crontab file which specifies the actions and times at which they should be executed, these jobs will run regardless of whether the user is actually logged into the system. There is also a root crontab for tasks requiring administrative privileges. This system crontab allows scheduling of systemwide tasks (such as log rotations and system database updates).
More information can be found:
man crontab
or from the OpenGroup specifications.
On Gnome-based Ubuntu systems Gnome Scheduled tasks tool (from the gnome-schedule package) in Applications –> System Tools provides a graphical interface with prompting for using Cron. The project website is at http://gnome-schedule.sourceforge.net/; the software is installable from the Software Center or by typing
sudo apt-get install gnome-schedule
in a terminal.
Using Cron
To use cron for tasks meant to run only for your user profile, add entries to your own user’s crontab file. Start the crontab editor from a terminal window:
crontab -e
Edit the crontab using the format described in the next sections. Save your changes. (Exiting without saving will leave your crontab unchanged.)
Note that a great source of information about the format can be found at:
man 5 crontab
Commands that normally run with administrative privileges (i.e. they are generally run using sudo) should be added to the root user’s crontab (instead of the user’s crontab):
sudo crontab -e
Crontab Sections
Each of the sections is separated by a space, with the final section having one or more spaces in it. No spaces are allowed within Sections 1-5, only between them. Sections 1-5 are used to indicate when and how often you want the task to be executed. This is how a cron job is laid out:
minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command
01 04 1 1 1 /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January. An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used. Code:
01 04 * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.
Comma-separated values can be used to run more than one instance of a particular command within a time period. Dash-separated values can be used to run a command continuously. Code:
01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.
The “/usr/bin/somedirectory/somecommand” text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. Enter which somecommand in the terminal to find the full path to somecommand. The crontab will begin running as soon as it is properly edited and saved.
You may want to run a script some number of times per time unit. For example if you want to run it every 10 minutes use the following crontab entry (runs on minutes divisible by 10: 0, 10, 20, 30, etc.)
*/10 * * * * /usr/bin/somedirectory/somecommand
which is also equivalent to the more cumbersome
0,10,20,30,40,50 * * * * /usr/bin/somedirectory/somecommand
Crontab Options
- The -l option causes the current crontab to be displayed on standard output.
- The -r option causes the current crontab to be removed.
- The -e option is used to edit the current crontab using the editor specified by the EDITOR environment variable.
After you exit from the editor, the modified crontab will be checked for accuracy and, if there are no errors, installed automatically. The file is stored in /var/spool/cron/crontabs but should only be edited via the crontab command.
Enable User Level Cron
If the /etc/cron.allow file exists, then users must be listed in it in order to be allowed to run the crontab command. If the /etc/cron.allow file does not exist but the /etc/cron.deny file does, then users must not be listed in the /etc/cron.deny file in order to run crontab.
In the case where neither file exists, the default on current Ubuntu (and Debian, but not some other Linux and UNIX systems) is to allow all users to run jobs with crontab.
No cron.allow or cron.deny files exist in a standard Ubuntu install, so all users should have cron available by default, until one of those files is created. If a blank cron.deny file has been created, that will change to the standard behavior users of other operating systems might expect: cron only available to root or users in cron.allow.
Note, userids on your system which do not appear in /etc/shadow will NOT have operational crontabs, if you desire to enter a user in /etc/passwd, but NOT /etc/shadow that user’s crontab will never run. Place an entry in /etc/shadow for the user with a * for the password crypt,ie:
joeuser:*:15169::::::
Further Considerations
Crontab commands are generally stored in the crontab file belonging to your user account (and executed with your user’s level of permissions). If you want to regularly run a command requiring administrative permissions, edit the root crontab file:
sudo crontab -e
Depending on the commands being run, you may need to expand the root users PATH variable by putting the following line at the top of their crontab file:
PATH=/usr/sbin:/usr/bin:/sbin:/bin
It is sensible to test that your cron jobs work as intended. One method for doing this is to set up the job to run a couple of minutes in the future and then check the results before finalising the timing. You may also find it useful to put the commands into script files that log their success or failure, for example:
echo "Nightly Backup Successful: $(date)" >> /tmp/mybackup.log
For more information, see the man pages for cron and crontab (man is detailed on the BasicCommands page). If your machine is regularly switched off, you may also be interested in at and anacron, which provide other approaches to scheduled tasks. For example, anacron offers simple system-wide directories for running commands hourly, daily, weekly, and monthly. Scripts to be executed in said times can be placed in /etc/cron.hourly/, /etc/cron.daily/, /etc/cron.weekly/, and /etc/cron.monthly/. All scripts in each directory are run as root, and a specific order to running the scripts can be specified by prefixing the scripts’ filenames with numbers (see the man page for run-parts for more details). Although the directories contain periods in their names, run-parts will not accept a file name containing a period and will fail silently when encountering them (bug #38022). Either rename the file or use a symlink (without a period) to it instead (see, for example, python + cron without login? and Problems with Hourly Cron Job).
Troubleshooting and Common Problems
Edits to a user’s crontab and jobs that are run on their behalf are all logged by default to /var/log/syslog and that’s the first place to check if things are not running as you expect.
When adding a new entry to a blank crontab, forgetting to add a newline at the end is a common source for the job not running. If the last line in the crontab does not end with a newline, no errors will be reported at edit or runtime, but that line will never run. See man crontab for more information. This has already been suggested as a bug.
If a user was not allowed to execute jobs when their crontab was last edited, just adding them to the allow list won’t do anything. The user needs to re-edit their crontab after being added to cron.allow before their jobs will run.
When creating a crontab for the root user, the user name must be specified as a parameter after the date/time parameters. Accidentally including the user name that way in a user-specific crontab will result in trying to run the user’s name as a command, rather than what was expected.
Entries in cron may not run with the same environment, in particular the PATH, as you expect them to. Try using full paths to files and programs if they’re not being located as you expect.
The “%” character is used as newline delimiter in cron commands. If you need to pass that character into a script, you need to escape it as “\%”.
If you’re having trouble running a GUI application using cron, see the GUI Applications section below.
Advanced Crontab
The Crontabs discussed above are user crontabs. Each of the above crontabs is associated with a user, even the system crontab which is associated with the root user. There are two other types of crontab.
Firstly, as mentioned above anacron uses the run-parts command and /etc/cron.hourly, /etc/cron.weekly, and /etc/cron.monthly directories. However anacron itself is invoked from the /etc/crontab file. This file could be used for other cron commands, but probably shouldn’t be. Here’s an example line from a ficticious /etc/crontab:
00 01 * * * rusty /home/rusty/rusty-list-files.sh
This would run Rusty’s command script as user rusty from his home directory. However, it is not usual to add commands to this file. While an experienced user should know about it, it is not recommended that you add anything to /etc/crontab. Apart from anything else, this could cause problem if the /etc/crontab file is affected by updates! Rusty could lose his command.
The second type of crontab is to be found in /etc/cron.d. Within the directory are small named crontabs. The directory is often used by packages, and the small crontabs allows a user to be associated with the commands in them.
Instead of adding a line to /etc/crontab which Rusty knows is not a good idea, Rusty might well add a file to /etc/cron.d with the name rusty, containing his cron line above. This would not be affected by updates but is a well known location.
When would you use these alternate crontab locations? Well, on a single user machine or a shared machine such as a school or college server, a user crontab would be the way to go. But in a large IT department, where several people might look after a server, then /etc/cron.d is probably the best place to install crontabs – it’s a central point and saves searching for them!
You may not need to look at /etc/crontab or /etc/cron.d, let alone edit them by hand. But an experienced user should perhaps know about them and that the packages that he/she installs may use these locations for their crontabs.
Special strings
Cron also offers some special strings:
-
string
meaning
@reboot
Run once, at startup.
@yearly
Run once a year, “0 0 1 1 *”.
@annually
(same as @yearly)
@monthly
Run once a month, “0 0 1 * *”.
@weekly
Run once a week, “0 0 * * 0”.
@daily
Run once a day, “0 0 * * *”.
@midnight
(same as @daily)
@hourly
Run once an hour, “0 * * * *”.
Usage: “@reboot /path/to/execuable1” will execute /path/to/executable1 when the system starts. See “man 5 crontab” for more info.
GUI Applications
It is possible to run gui applications via cronjobs. This can be done by telling cron which display to use.
00 06 * * * env DISPLAY=:0 gui_appname
The env DISPLAY=:0 portion will tell cron to use the current display (desktop) for the program “gui_appname”.
And if you have multiple monitors, don’t forget to specify on which one the program is to be run. For example, to run it on the first screen (default screen) use :
00 06 * * * env DISPLAY=:0.0 gui_appname
The env DISPLAY=:0.0 portion will tell cron to use the first screen of the current display for the program “gui_appname”.
Note: GUI users may prefer to use gnome-schedule (aka “Scheduled tasks”) to configure GUI cron jobs. In gnome-schedule, when editing a GUI task, you have to select “X application” in a dropdown next to the command field.
Note: In Karmic(9.10), you have to enable X ACL for localhost to connect to for GUI applications to work.
~$ xhost +local: non-network local connections being added to access control list ~$ xhost access control enabled, only authorized clients can connect LOCAL: ...
Tips
crontab -e uses the EDITOR environment variable. to change the editor to your own choice just set that. You may want to set EDITOR in you .bashrc because many commands use this variable. Let’s set the EDITOR to nano a very easy editor to use:
export EDITOR=nano
There are also files you can edit for system-wide cron jobs. The most common file is located at /etc/crontab, and this file follows a slightly different syntax than a normal crontab file. Since it is the base crontab that applies system-wide, you need to specify what user to run the job as; thus, the syntax is now:
minute(s) hour(s) day(s)_of_month month(s) day(s)_of_week user command
It is recommended, however, that you try to avoid using /etc/crontab unless you need the flexibility offered by it, or if you’d like to create your own simplified anacron-like system using run-parts for example. For all cron jobs that you want to have run under your own user account, you should stick with using crontab -e to edit your local cron jobs rather than editting the system-wide /etc/crontab.
Crontab Example
Below is an example of how to setup a crontab to run updatedb, which updates the slocate database: Open a term, type “crontab -e” (without the double quotes) and press enter. Type the following line, substituting the full path of the application you wish to run for the one shown below, into the editor:
45 04 * * * /usr/bin/updatedb
Save your changes and exit the editor.
Crontab will let you know if you made any mistakes. The crontab will be installed and begin running if there are no errors. That’s it. You now have a cronjob setup to run updatedb, which updates the slocate database, every morning at 4:45.
Note: The double-ampersand (&&) can also be used in the “command” section to run multiple commands consecutively, but only if the previous command exits successfully. A string of commands joined by the double-ampersand will only get to the last command if all the previous commands are run successfully. If exit error-checking is not of a concern, string commands together, separated with a semi-colon (;)
45 04 * * * /usr/sbin/chkrootkit && /usr/bin/updatedb
The above example will run chkrootkit followed by updatedb at 4:45am daily – providing you have all listed apps installed. If chkrootkit fails, updatedb will NOT be run.
How Anacron is Arranged
On Ubuntu 9.10 (and presumably, on later versions), anacron seems to be set up as follows:
There is a Upstart task, located in /etc/init/anacron.conf, which runs all the jobs in /etc/anacrontab. It is set to run on startup.
There is a cron.d file (/etc/cron.d/anacron) which causes the Upstart task to be started every day at 7:30 AM.
There is a file /etc/apm/event.d/anacron, which causes the Upstart task to be started when a laptop is plugged in to A/C power, or woken up.
In the system crontab (/etc/crontab), if anacron is not execuatable, run-parts is used to run the files in cron.daily, cron.weekly, and cron.monthly at 6:25 AM, 6:47 AM and 6:52 AM, respectively.
In /etc/anacrontab, run-parts is used to run cron.daily 5 minutes after anacron is started, and cron.weekly after 10 minutes (once a week), and cron.monthly after 15 (once a month).
Within the cron.daily, weekly, and monthly directories ( /etc/cron.daily, etc.) there is a 0anacron file that sets the timestamps for anacron, so it will know they have been run, even if it didn’t run them.
So it appears anacron is run on every startup, wake up, plug-in, and at 7:30 AM every day. Looking at the respective Changelogs and package databases, it looks like this setup is directly from Debian, and hasn’t been changed since at least 2009.
-
VMRC 控制台的连接已断开…正在尝试重新连接
故障状态:
用vSphere Client连接到ESXi 5.0的主机,启动其中的虚拟机后,无法连接控制台,打开控制台之后,窗口上方提示一行“VMRC 控制台的连接已断开…正在尝试重新连接。”1.在安装VSphere
Client的主机上,以管理员模式进入cmd.exe,然后运行Data Execution Prevention(DEP):bcdedit.exe /set nx AlwaysOff 2.卸载VSphere
Client,重启机器 3.重新安装VSphere
Client Vmware vSphere常见问题及解决办法
1. 虚拟机文件被锁,无法正常 power on
故障状态:
启动虚拟机时95%,停顿并且进程中断,提示:ubable to access files since it is locked。
祸根:HA
解决方法:
(1)首先将cluster中的HA功能关闭。如果该功能不关闭,容易造成死锁,,VM不断跳动,,不断再不同的ESX内循环被锁,徒劳而无功。
(2)磁盘文件被锁,要解决,必须要知道到底是哪台ESX把他给锁住了,这是关键。
方法:看/var/log/vmkernel但是,在做这些前, 再准备些别的工作。
(3)在VC中,把被锁的VM从Inventory中remove掉。原因很简单,这是一个 unregister的过程。
(4)根据/var/log/vmkernel,搜索owner,可以找到类似以下的语句:
Oct 19 04:23:33 esx-hostname vmkernel: 3:06:29:47.992 cpu6:1656)FS3: 1975: Checking if lock holders are live for lock [type 10c00001 offset 52008960 v 380, hb offset 3554304 Oct 19 04:23:33 esx-hostname vmkernel: gen 17, mode 1, owner 48f5f637-462688bc-fd28-0e1a6434b6f8 mtime 38112]
OK,owner后面的48f5f637-462688bc-fd28-0e1a6434b6f8就是你的target了。 因为他就是锁住VM 的宿主.。(5)根据以下命令,,找出到底哪台ESX的UUID是 48f5f637-462688bc-fd28-0e1a6434b6f8
[root@esxhostname root]# esxcfg-info |grep -i ‘system uuid’
(6)找到目标主机后,当然是杀死他锁住VM的进程。之所以会被锁,原因就是HA 把VM从别的HOST迁移过来,但是又没有unregister和register的过程,所以在第3步的时候,你查看VM的Summary的时候,host ip还是属于出问题的 host。 但是VM又被新的host霸王硬上功的power on,注册都没注册, 又怎么启动呢。找到 PID 用下面的命令:
ps -efwww|grep virtualmachine.vmx
找到 PID 后, kill -9 PID
(7)这时候,还要确定一件事情, .vswp文件的事情。这个是给台客处理问题时吸取的经验。就因为忽略了这个,所以在杀掉迚程后,重新注册VM,还说没有 SWAP文件,启动还是失败。
在 VM 启动时会自动生成SWAP,没有SWAP文件,其实就是因为 SWAP 存在了, 因为重名而导致无法正常生成。
进入到/vmfs/volumes/lunid/vm_path/下,vmkfs -d virtual_machine.vswp 或者进入Datastore Browser,在里面把SWAP文件删除也可。(8)完全之策,你还可以进入到VM的SETTINGS–OPTIONS–SWAPFILE LOCATION, 对该保存的位置做下设置。
(9)重新注册VM。进入Datastore Browser,找到VM.vmx,add to inventory。
(10)启动 VM. Good Luck。
2. 忽视掉ESXi/vCenter Server提示SSH事件的方法
(1) vSphere Client连接到VC或者ESXi服务器;(2) 在Home -> Inventory -> Hosts and Clusters里展开选中你的ESX服务器;
(3) 右边选择Configuration,然后点击Software栏目里的Advanced Settings;(4) 在Advanced Settings里选择左边列表中的UserVars;
(5) 选中左边列表中的UserVars后,在右边拖到最下面,将UserVars.SuppressShellWarning的值改为1即可,不需要重启。
3. 尝试迁移一台带USB设备的VM失败
故障状态:
在执行虚拟机迁移向导时,如果系统检测到不兼容的USB设备存在,则系统会提示如下错误信息:
Currently connecteddevice ‘USB 1’ uses backing ‘path:1/7/1’,which is not accessible.
故障分析:
这种问题通常发生在为主机开启了VMDirectPath I/O支持下的USB Passthrough Devices功能,然后为特定的VMs分配了USB设备,比如:加密狗;
解决方案:
(1)确认USB设备能够被虚拟机识别和支持,并确保在添加USB设备到VMs时,勾选了with vMotion选项;
(2)在执行vMotion动作之前,重新尝试将USB设备添加到VMs;
(3)确认ESXi主机没被重启过,因为,ESXi主机重启之后,原本支持的vMotion WithvMotion功能将会失效。
4. Convert Linux系统的Troublshooting过程
(1)确认源转换Linux机器的OS在官方的支持列表中;
(2)拥有root权限;
(3)确认DNS的设定有没有问题,注意:应该同时在Linux和Windows都加上;
(4) 确认源Linux能够ping同ESX或vCenter的IP。如果在2%时失败,最大的可能就是权限问题或防火墙阻隔问题;
(5) 确认Linux允许SSH登陆进去。这个,可以帮助我们在converting的时候登录到Linux系统;
(6)确认是给helper virtual machine设定的静待IP,而不是DHCP获取的(如果网内没有DHCP服务器);
(7)确认源和目标都在同一子网。如果通过路由链接的不同子网可能会出错;
(8) 注意,converter不支持做了软阵列的Linux系统。可以用冷克隆光盘来做,它会把软阵列的设定为/dev/md0。
(9) VMware Converter Standalone的日志目录:C:\Documents and Settings\All Users\Application Data\VMware\VMware vCenter Converter Standalone,用于排错时用。
5. vCenter Service Status页面故障:Unable to retrieve health status
故障状态:
vCenter Server Status页面提示如下错误信息:
Unable to retrieve health status for vCenter inventory service
Unable to retrieve health status for VMware vSphere Profile-Driven storage service
执行vCenter Server的搜索动作时,提示如下错误提示:
Unable to connect to webservices to perform query.
Verify that the “VMware VirtualCenter Management WebServices” service running onhttps://<vcenter-host-name>:10443
故障分析:
这个问题一般都由于当vCenter Server服务发生了变更或全新安装了一台vCenter Server,但是数据库依然是原来的数据库导致;
解决方案:
替换掉vws.jar、jointool.jar和ds.jar文件即可,步骤如下:
下载本文附件中的vws.zip文件然后解压缩vws.jar、jointool.jar和ds.jar文件;
停止掉VirtualCenter Server服务以及VirtualCenter Management Webservices服务;拷贝vws.jar和jointool.jar到C:\ProgramFiles\VMware\Infrastructure\tomcat\webapps\WEB-INF\lib覆盖掉原来的文件;拷贝ds.jar文件到C:\Program Files\VMware\Infrastructure\Inventory Service\lib覆盖掉原来的文件;重新启动相关服务或vCenter Server服务器即可。
6. VMRC 控制台的连接已断开…正在尝试重新连接
故障状态:
用vSphere Client连接到ESXi 5.0的主机,启动其中的虚拟机后,无法连接控制台,打开控制台之后,窗口上方提示一行“VMRC 控制台的连接已断开…正在尝试重新连接。”
故障分析:
从情况看,类似于Windows系统的DEP策略处于开启状态导致的问题一样。但这个情况是所有虚拟机都提示这个错误,排错DEP的问题,用本地vSphere Client登录一个VC平台,问题仍旧一样。为了排除问题,换了一台笔记本登录VC,突然发现问题不见了。原来是本地的vSphere Client出了问题,再三思索,发现出现问题前我对本地WIN7用360安全卫士升级了补丁,是否是补丁破坏了vSphere Client某个文件呢
解决方案:
重现安装vSphere Client,问题解决。
7. 端口 80 的 vCenter Server 和 IIS 之间的冲突
故障状态:
vCenter Server 和 Microsoft Internet Information Service (IIS) 都将端口 80 用作直接 HTTP 连接的默认端口。该冲突会导致安装 vSphere Authentication Proxy 后 vCenter Server 无法重新启动。 在 vSphere Authentication Proxy 安装完成后, vCenter Server 无法重新启动。
故障分析:
如果安装 vSphere Authentication Proxy 时未安装 IIS ,则安装程序会提示您安装 IIS 。因为 IIS 使用端口 80 ,这是用于 vCenter Server 直接 HTTP 连接的默认端口, 所以 vCenter Server 在 vSphere Authentication Proxy。安装完成后无法重新启动。请参见第 32 页,“ vCenter Server 所需的端口” 。
解决方案:
要为端口 80 解决 IIS 和 vCenter Server 之间的冲突,请执行以下操作之一。
如果在安装 vCenter Server 之前已安装 IIS 将 vCenter Server 直接 HTTP 连接的端口由 80 更改为其他值。 如果在安装 IIS 之前已安装 vCenter Server 重新启动 vCenter Server 之前, 将 IIS 默认网站的绑定端口由 80 更改为其他。
8. 在 UEFI 模式下安装 ESXi 后主机无法引导
故障状态:
在 UEFI 模式下, 在主机上安装 ESXi 后重新引导时, 重新引导可能失败。 出现此问题的同时, 还显示一条类似于以下内容的错误消息: 发生异常网络错误。无可用的引导设备 (Unexpected network error. No boot device available)。
故障分析:
主机系统无法识别作为引导磁盘在其上安装 ESXi 的磁盘。
解决方案:
(1)屏幕上显示错误消息时,按 F11 显示引导选项。
(2)选择一个类似于添加引导选项的选项。该选项的文字可能有所不同,具体取决于您的系统。
(3)在安装 ESXi 的磁盘上选择文件 \EFI\BOOT\BOOTx64.EFI 。
(4)更改引导顺序,以便主机从添加的选项引导。
9. 将 Microsoft SQL 数据库设置为不受支持的兼容模式会导致 vCenter Server 安装或升级失败。当数据库设置为不支持的版本的兼容性模式时,使用 Microsoft SQL 数据库的 vCenter Server 安装会失败。
故障状态:
将显示以下错误消息: 输入的数据库用户没有使用选定数据库安装和配置 vCenter Server 所需的必要权限。 请更正以下错误 : %s
故障分析:
数据库版本必须是 vCenter Server 支持的版本。 对于 SQL , 即使数据库是受支持的版本, 但如果将其设置为以不支持的版本的兼容性模式运行, 仍会发生此错误。 例如, 如果将 SQL 2008 设置为以 SQL 2000 兼容性模式运行,就会发生此错误。
解决方案:请确保 vCenter Server 数据库是受支持的版本, 并且没有设置为以不支持的版本的兼容性模式运行。
10. 误删运行中的虚拟机,通过xx-flat.vmdk恢复方法
故障状态:误删了运行中的虚拟机,进入目录查看,只剩下xx-flat.vmdk文件,从文件的类型看,只是File格式,不是Virtual Disk格式,新建虚拟,选择添加已存在磁盘,提示不存在
解决方案:
(1)新建一虚拟机,不要创建硬盘
(2)用ssh的方式登录host,查找xx-flat.vmdk文件所在位置及目录,
(3)在上面这个文件相同目录下创建新xxx.vmdk文件,大小要和xx-flat.vmdk文件一样大,
用ls -la查看xx-flat.vmdk文件大小,
用vmkfstools -c 文件大小 -a lsilogic xxx.vmdk 来创建新磁盘文件
(4)将这个磁盘文件添加到新建的虚拟机中;
(5)用原文件xx-flat.vmdk覆盖新建的xxx-flat.vmdk(注意一定是-flat.vmdk),使用mv命令
(6)完成后开启虚拟机就可以了。 -
Windows8 各版本区别详解【核心版、Pro专业版、Enterprise企业版、RT版】
Windows 8 分为四个版本:
1、Windows RT
2、Windows 8 核心版
3、Windows 8 Pro 专业版
4、Windows 8 Enterprise 企业版Windows 8包括普通版、Pro专业版、Enterprise企业版和Windows RT,其中Windows RT不单独零售,仅预装在采用ARM处理器的PC或平板机中,也就是说,普通消费者可以购买或升级的Windows 8版本仅有普通版和专业版。PS:对于中国市场,微软还提供了本地语言版Windows 8,即中国版Windows 8。
对于大多数消费者来说,Windows 8普通版是最佳选择。该版本包括所有用户日常工作生活所需功能,包括Windows Store应用商店、新版的Windows Explorer资源管理器、任务管理器、更好地多屏支持,还包括一些之前仅在企业版/旗舰版Windows中提供的服务。
Windows 8 Pro专业版则是面向技术爱好者和企业/技术专业人员设计的,提供了更多的Windows 8技术,它包括Windows 8普通版的所有功能,另外还新增了加密、虚拟化、PC管理、域名连通等功能。Windows Media Center也将作为“媒体包”扩展(add-on)在该版本中提供。
Windows 8企业版(Enterprise)包括Windows 8 Pro专业版所有功能,此外还专为企业新增了PC管理和部署、安全、虚拟化、移动等功能。
Windows RT内置针对触摸操作优化的桌面版Office(Word、Excel、PowerPoint和OneNote),但是不兼容x86/64软件,也就是说它不能运行为现有Windows系统开发的软件。开发人员可以使用新的运行时WinRT为该系统开发应用程序。
它们的功能区分在哪里呢?请见Windows 8 各版本功能区别详细列表: -
Synergy 一套键鼠同时控制多台电脑的神器!超级方便!(开源免费,支持Win/Mac/Linux)
Synergy 一套键鼠同时控制多台电脑的神器!超级方便!(开源免费,支持Win/Mac/Linux)
http://www.iplaysoft.com/synergy.html -
notepad++使用教程
插件之 TextFX (安装及作用)
Notepad++插件TextFX Characters是一款默认安装的插件,由于功能强大,被编程爱好者认为是最好的Notepad++插件,第二名是Light Explorer。但由于TextFX插件命令过多,而且没有汉化版,不容易理解,闪电博客特别介绍下几个常用命令功能:
1. 删除程序空行
选择相应的文本
点击TextFX —> TextFX Edit —> Delete Blank Lines
点击TextFX —> TextFX Edit —> Delete Surplus Blank Lines
2. 为代码增加行号
选择要增加行号的文本(选择时会提示“No text selected”)
点击TextFX —> TextFX Tools —> Insert Line Numbers
3. 删除程序行号或者首字
选择相应的文本
点击TextFX —> TextFX Tools —> Delete Line Numbers or First word
4. 整理xml文本格式。
这个功能不错,可以很快将一行文本整理成规范的xml文件。(这个功能用来处理blogger的xml文档很不错,我自己的文档经过无数次的编辑已经乱得不成样子,经过这样一整理,可读性大大提高。)
选中所有文本
点击TextFX—>HTML Tidy—>Tidy: Reindent XML
同样在处理HTML文件,也有类似功能。
5. 改变字符大小写
选择相应的文本
点击TextFX —> TextFX Characters, 可以选择如下几种形式:
UPPER CASE 全部大写
lower case 全部小写
Proper Case 首字大写
Sentense case 句子模式
iNVERT cASE 首字小写,其他大写
6. 去掉文本中的HTML元素
选择HTML元素
点击TextFX —> TextFX Convert —> Strip HTML tags table tabs
7. 转换为HTML实体
即把“<”转换成“<”、把“>”转换成 “>”。(可以用来轻松为blogger的文章插入代码。)
选择相应的文本
点击TextFX —> TextFX Convert —> Encode HTML (&<>”)
8.其它
TextFX Characters -> UPPER CASE, lower case, Proper Case, Sentence case, iNVERT cASE: 批量改变选中文字的大小写。
TextFX Edit -> Delete Blank Lines: 删除空格。
TextFX Edit -> Delete Surplus Blank Lines: 将选中文字的多个连续空格转换成一个空格。
TextFX Convert -> Encode URI Component: 转换选中文字中的标点符号成16进制,让其对URL友好。
TextFX Convert -> Encode HTML (&<>”): 将HTML文件中的尖角符号转换成16进制。
TextFX HTML Tidy -> Tidy Reindent XML: 将未格式化的xml文件按照规格缩进。(很实用的说)
TextFX Tools -> Sort lines case sensitive, Sort lines case insensitive: 排序。
TextFX Tools -> Insert Line Numbers: 为选中的文字加上行号,基于此文件的第一行排序。
TextFX Tools -> Word Count: 对选中的文字记数,包括详细的文字总数,行数等等。 -
自动带日期cp文件
cp listener.ora listener.ora.$(date +%Y%m%d)
脚本
#set date time now
a=`date +%Y%m%d-%H:%M:%S`
#copy UTNSERVER.LOG to /log
cp -f /opt/utnsvr/yxxl/server/UTNSERVER.LOG /opt/utnsvr/yxxl/log/$a.log -
CentOS下修改httpd.conf开启gzip压缩传输
1. 首页查看一下mod_deflate、mod_headers两个模块是否开启,
cat /etc/httpd/conf/httpd.conf | grep mod_deflate
#输出LoadModule deflate_module modules/mod_deflate.so
cat /etc/httpd/conf/httpd.conf | grep mod_headers
#输出LoadModule headers_module modules/mod_headers.so如果列出文字前都带#号,修改httpd.conf去除
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so2. 在httpd.conf末尾加入下面文字,并保存
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary
AddOutputFilterByType DEFLATE text/*
AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript
</IfModule>注解:
SetOutputFilter DEFLATE
设置压缩等级,可设置为1到9.数字越大压缩比例越高,相应cpu也越累
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:pdf|doc|avi|mov|mp3|rm)$ no-gzip dont-vary以上三行分别设置对图片、压缩文件、视频文件等格式的文件不使用gzip压缩
AddOutputFilterByType DEFLATE text/*
对文字启用压缩
AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript
对js启用压缩
例子:
#######################################
<IfModule deflate_module>
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:pdf|doc|avi|mov|mp3|rm)$ no-gzip dont-vary
AddOutputFilterByType DEFLATE text/*
AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript
</IfModule>
#######################################
3. 重启httpdservice httpd restart
