本文将为您提供关于Centos7:timedatectl命令的详细介绍,我们还将为您解释centostimewait的相关知识,同时,我们还将为您提供关于.MySQLNonTransientConne
本文将为您提供关于Centos7:timedatectl命令的详细介绍,我们还将为您解释centos timewait的相关知识,同时,我们还将为您提供关于.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.、CentOS 7 时区设置 timedatectl、CentOS 7上安装WordPress详细步骤 centos7忘记 centos7的pxe centos7加、CentOS 7时间命令timedatectl的实用信息。
本文目录一览:- Centos7:timedatectl命令(centos timewait)
- .MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.
- CentOS 7 时区设置 timedatectl
- CentOS 7上安装WordPress详细步骤 centos7忘记 centos7的pxe centos7加
- CentOS 7时间命令timedatectl
Centos7:timedatectl命令(centos timewait)
Centos7中增加了timedate命令来时间对日期、时间和时区的控制。
[root@node1 ~]# timedatectl --help
timedatectl [OPTIONS...] COMMAND ...
Query or change system time and date settings.
-h --help Show this help message
--version Show package version
--no-pager Do not pipe output into a pager
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--adjust-system-clock Adjust system clock when changing local RTC mode
Commands:
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Control whether NTP is enabled
一、显示日期、时间、时区等相关信息
[root@node1 ~]# timedatectl
Local time: 日 2016-04-17 00:20:06 CST
Universal time: 六 2016-04-16 16:20:06 UTC
RTC time: 六 2016-04-16 16:20:06
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
二、修改时间
执行如下命令修改时间:
timedatectl set-time HH:MM:SS
备注:同时修改hardware clock和system clock.
例子:
[root@node1 ~]# timedatectl set-time 09:57:30
[root@node1 ~]# date
2016年 04月 17日 星期日 09:57:32 CST
三、修改日期
执行如下命令修改日期:
timedatectl set-time YYYY-MM-DD
备注:修改日志不同时修改时间,将重置现在的时间为00:00:00.
例子:
[root@node1 ~]# timedatectl set-time 2016-04-18
[root@node1 ~]# date
2016年 04月 18日 星期一 00:00:01 CST
四、同时修改日期和时间
执行如下命令同时修改日期和时间:
timedatectl set-time ''YYYY-MM-DD HH:MM:SS''
例子:
[root@node1 ~]# timedatectl set-time ''2016-04-18 10:01:20''
[root@node1 ~]# date
2016年 04月 18日 星期一 10:01:21 CST
五、修改时区
执行如下命令显示可用的时区:
timedatectl list-timezones
[root@node1 ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
...
执行如下命令设置使用的时区:
timedatectl set-timezone time_zone
[root@node1 ~]# timedatectl set-timezone Asia/Shanghai
[root@node1 ~]# date
2016年 04月 18日 星期一 10:05:28 CST
[root@node1 ~]# ls -lrt /etc/localtime
lrwxrwxrwx 1 root root 35 4月 17 00:08 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
六、同步时间到一个远程服务器
timedatectl命令可以用来控制是否开启NTP,开启NTP将启动chronyd或者ntpd服务,依赖于被安装的那个。
timedatectl set-ntp boolean
开启:
timedatectl set-ntp yes
关闭:
timedatectl set-ntp no
备注:
执行set-ntp时会同时开启或关闭ntpd或者chronyd服务。但是ntpd服务和chronyd可以通过systemctl命令来单独控制,不是必须使用timedatectl来进行控制。
如果使用set-ntp是yes的状态(即:timedatectl命令中NTP enabled状态显示为yes,那么将不能同时使用set-time来修改时间。
[root@node3 ~]# timedatectl
Local time: 一 2016-04-18 10:25:48 CST
Universal time: 一 2016-04-18 02:25:48 UTC
RTC time: 六 2016-04-16 17:09:34
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
[root@node3 ~]# timedatectl set-time ''2016-04-18 10:25:58''
Failed to set time: Automatic time synchronization is enabled
[root@node3 ~]# timedatectl set-ntp no
[root@node3 ~]# timedatectl
Local time: 一 2016-04-18 10:26:16 CST
Universal time: 一 2016-04-18 02:26:16 UTC
RTC time: 六 2016-04-16 17:10:02
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
[root@node3 ~]# timedatectl set-time ''2016-04-18 10:26:28''
.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2385) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2306) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.GeneratedConstructorAccessor4.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346) at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:443) at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:141) at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:111) at cn.qjj.mysql.MySQLPool.getNewConnection(MySQLPool.java:72) at cn.qjj.mysql.MySQLPool.init(MySQLPool.java:63) at cn.qjj.mysql.MySQLPool.<init>(MySQLPool.java:32) at cn.qjj.mysql.MySQLPool.getInstance(MySQLPool.java:39) at cn.qjj.mysql.SqlUtils.<clinit>(SqlUtils.java:33) at cn.qjj.solr.MsgUtil.main(MsgUtil.java:31) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections" at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1112) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2483) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2324) ... 18 more java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) at cn.qjj.mysql.MySQLPool.init(MySQLPool.java:63) at cn.qjj.mysql.MySQLPool.<init>(MySQLPool.java:32) at cn.qjj.mysql.MySQLPool.getInstance(MySQLPool.java:39) at cn.qjj.mysql.SqlUtils.<clinit>(SqlUtils.java:33) at cn.qjj.solr.MsgUtil.main(MsgUtil.java:31)
CentOS 7 时区设置 timedatectl
[root@testandy ~]# timedatectl --help
timedatectl [OPTIONS...] COMMAND ...
Query or change system time and date settings.
-h --help Show this help message
--version Show package version
--no-pager Do not pipe output into a pager
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--adjust-system-clock Adjust system clock when changing local RTC mode
Commands:
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Control whether NTP is enabled
设置时区同样,在 CentOS 7 中,引入了一个叫 timedatectl 的设置设置程序.
用法很简单:
timedatectl # 查看系统时间方面的各种状态
$timedatectl status
Local time: 四 2014-12-25 10:52:10 CST
Universal time: 四 2014-12-25 02:52:10 UTC
RTC time: 四 2014-12-25 02:52:10
Timezone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
timedatectl list-timezones # 列出所有时区
timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
其实不考虑各个发行版的差异化,从更底层出发的话,修改时间时区比想象中要简单:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
CentOS 7上安装WordPress详细步骤 centos7忘记 centos7的pxe centos7加
一、搭建
php 5.2.4 或者更高版本、MySQL 5.0 或者更高版本。
二、搭建Wordpress平台:
以下以Wordpress3.92版本为例进行说明,如果大家想安装最近版本的话,安装完成后再管理界面可以自动升级安装最新版本。
1、建立一个临时文件夹,下载最新版本的Wordpress3.92,中英文都可以:
mkdir /tmp/wp cd /tmp/wp wget http://wordpress.org/latest.zip
2、解压缩到网站根目录: 由于我是使用的LAMP一键安装包安装的LAMP,所以默认网站根目录为/data/www/default,大家在实际安装过程中注意自己的根目录。
unzip -q latest.zip -d /data/www/default/
3、更改wordpree文件夹属主和权限
chown -R apache:apache /data/www/default/wordpresschmod -R 755 /data/www/default/wordpress
4、创建一个可以上传的目录upload,并将属主改为apache
mkdir -p /data/www/default/wordpress/wp-content/uploads chown -R :apache /data/www/default/wordpress/wp-content/uploads
5、修改配置文件,以便可以访问数据库
cd /data/www/default/wordpress/ cp wp-config-sample.php wp-config.php vim wp-config.php 修改部分分别为数据库名称、数据库用户名、数据库用户密码,大家根据实际修改: define(''DB_NAME'', ''wp_database''); define(''DB_USER'', ''root''); define(''DB_PASSWORD'', ''root''); 修改完成后 :wq!
6、浏览器浏览 安装
浏览器输入http://http://127.0.0.1/wordpress/wp-admin/install.php 后就可以进行最后的登陆安装: 输入站点名称,登陆户名,密码,邮箱就可以完成Wordpress的安装。 由于我是本地搭建的,所以是127.0.0.1,如果申请了域名,这里就是域名了。
7、开启支持网站固定链接修改和重定向功能。 编辑主配置文件:
vi /etc/httpd/conf/httpd.conf AllowOverride None 修改为: AllowOverride All 然后重启服务: systemctl restart httpd.service 创建.htaccess文件: touch /data/www/default/wordpress/.htaccess 编辑.htaccess文件: vim /data/www/default/wordpress/.htaccess 看是否有以下内容,没有自己添加,有可能网站会自动生成。 <ifmodule> RewriteEngine On RewriteBase /wordpress/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L]</ifmodule> 修改.htaccess文件权限: chmod 664 /data/www/default/wordpress/.htaccess 修改为664可以让网站支持自动更新,也可以修改为644。
至此,Wordpress在Centos7上已经完全安装了,可以用它搭建你想要的任意网站了。
本文转载自:http://www.linuxprobe.com/centos7-install-wordpress-detail-steps/
免费提供最新Linux技术教程书籍,为开源技术爱好者努力做得更多更好:http://www.linuxprobe.com/
以上就介绍了CentOS 7上安装WordPress详细步骤,包括了wordpress,centos 7方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
CentOS 7时间命令timedatectl
在CentOS 6版本,时间设置有date、hwclock命令
一、基本概念
1.1 GMT、UTC、CST、DST 时间
(1) UTC
整个地球分为二十四时区,每个时区都有自己的本地时间。在国际无线电通信场合,为了统一起见,使用一个统一的时间,称为通用协调时(UTC, Universal Time Coordinated)。
(2) GMT
格林威治标准时间 (Greenwich Mean Time)指位于英国伦敦郊区的皇家格林尼治天文台的标准时间,因为本初子午线被定义在通过那里的经线。(UTC与GMT时间基本相同,本文中不做区分)
(3) CST
中国标准时间 (China Standard Time)
代码如下:
GMT + 8 = UTC + 8 = CST
(4) DST
夏令时(Daylight Saving Time) 指在夏天太阳升起的比较早时,将时钟拨快一小时,以提早日光的使用。(中国不使用)
1.2 硬件时钟和系统时钟
(1) 硬件时钟
RTC(Real-Time Clock)或CMOS时钟,一般在主板上靠电池供电,服务器断电后也会继续运行。仅保存日期时间数值,无法保存时区和夏令时设置。
(2) 系统时钟
一般在服务器启动时复制RTC时间,之后独立运行,保存了时间、时区和夏令时设置。
二、timedatectl 命令
2.1 读取时间
代码如下:
timedatectl //等同于 timedatectl status
2.2 设置时间
代码如下:
timedatectl set-time "YYYY-MM-DD HH:MM:SS"
2.3 列出所有时区
代码如下:
timedatectl list-timezones
2.4 设置时区
代码如下:
timedatectl set-timezone Asia/Shanghai
2.5 是否NTP服务器同步
代码如下:
timedatectl set-ntp yes //yes或者no
2.6 将硬件时钟调整为与本地时钟一致
代码如下:
timedatectl set-local-rtc 1
hwclock --systohc --localtime //与上面命令效果一致
注意 硬件时钟默认使用UTC时间,因为硬件时钟不能保存时区和夏令时调整,修改后就无法从硬件时钟中读取出准确标准时间,因此不建议修改。修改后系统会出现下面的警告。
2.6 硬件时间设置成 UTC:
代码如下:
timedatectl set-local-rtc 1
hwclock --systohc --utc //与上面命令效果一致
关于Centos7:timedatectl命令和centos timewait的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.、CentOS 7 时区设置 timedatectl、CentOS 7上安装WordPress详细步骤 centos7忘记 centos7的pxe centos7加、CentOS 7时间命令timedatectl等相关内容,可以在本站寻找。
本文标签: