was jvm内存设置,多大合适?
分析了当前比较流行的几个不同公司不同版本JVM的最大内存,得出来的结果如下:公司JVM版本 最大内存(兆)client 最大内存(兆)serverSUN 1.5.x 1492 1520SUN 1.5.5(Linux) 2634 2660SUN 1.4.2 1564 1564SUN 1.4.2(Linux) 1900 1260IBM
如何在linux suse中配置NTP服务器?
在suse上配置ntp
$vim /etc/ntp.conf
#增加时间源
server 192.168.56.1
$chkconfig ntp on # 在系统重启时启动服务
$service ntp start # 启动ntp
$service ntp status # 查看ntp状态
问题:
1)为什么在故意改了一个错误的时间,ntpd没有更新时间?
如果差异很大,需要重新doing an Initial Synchronization,If the time on the local server is very different from that of its primary time server your NTP daemon will eventually terminate itself leaving an error message in the /var/log/messages file. You should run the ntpdate -u command to force your server to become instantly synchronized with its NTP servers before starting the NTP daemon for the first time. The ntpdate command doesn’t run continuously in the background, you will still have to run the ntpd daemon to get continuous NTP updates.
2)/etc/ntp.conf中选择主NTP Server
选择了哪个server做为主server是按stratum的大小决定的?应该不是,由ntp的算法决定,如在virtualbox中的suse怎么样都无法选择外部时钟源,ntpd在几次poll time后算法就决定使用local源,郁闷啊。由于是虚拟机中运行,时钟和cpu的频率有关系,跳得比真实的硬件快,在virtaulbox中ntp的算法认为local源比外部源更准确就使用了local的,解决的方法可以去掉local源,只使用外部源或者在crontab中每分钟执行一次ntpdate了。
即使把本机的stratum设置为比外部源更高的,过了一段时间以后,virtualbox中的suse还是选择了local,郁闷again
fudge 127.127.1.0 stratum 12 # not disciplined
remote refid st t when poll reach delay offset jitter
==============================================================================
LOCAL(0) .LOCL. 15 l 9 64 1 0.000 0.000 0.002
192.168.56.1 139.114.32.134 14 u 8 64 1 3.739 -53.045 0.002
注意最开始的时候,ip地址前面是没有符号的,poll几次以后ntp就会选择一个主时间源,前面带 * 号标识。
3)windows上的ntp server配置
官方ntp.org推荐的win上的ntp server,http://www.meinberg.de/german/sw/ntp.htm
3)如何知道ntp的运行状态
使用ntpq命令
$watch ntpq -p # 可以使用watch命令来查看一段时间内服务器各项数值的变化
使用ntpq命令查看与您同步的服务器. 它提供你一份时间服务器配置清单,包括延误值(delay),偏差值(offset)和抖动值(jitter). 为了能正确同步,延迟值和偏移值应该不为零,抖动值(jitter)应小于100 .
$/usr/local/ntp/bin/ntpq -p
显示如下:
remote refid st t when poll reach delay offset jitter
========================================================
time.nist.gov .ACTS. 1 u 1606 1024 22 357.845 334.375 71.122
*LOCAL(0) .LOCL. 10 l 11 64 377 0.000 0.000 0.001
ntpq -p 可以列出目前我们的NTP与相关的上层NTP的状态,几个字段的意义为:
remote:亦即是 NTP 主机的 IP 或主机名称啰~注意最左边的符号,http://www.ece.udel.edu/~mills/ntp/html/decode.html#peer
*
它告诉我们远端的服务器已经被确认为我们的主NTP Server,我们系统的时间将由这台机器所提供
+
它将作为辅助的NTP Server和带有*号的服务器一起为我们提供同步服务. 当*号服务器不可用时它就可以接管
–
远程服务器被clustering algorithm认为是不合格的NTP Server
x
远程服务器不可用
refid:参考的上一层 NTP 主机的地址
st:stratum 阶层
when:几秒钟前曾经做过时间同步化更新的动作;
poll:下一次更新在几秒钟之后;
reach:已经向上层 NTP 服务器要求更新的次数
delay:网络传输过程当中延迟的时间,单位为 10^(-6) 秒
offset:时间补偿的结果,单位与 10^(-6) 秒
jitter:Linux 系统时间与 BIOS 硬件时间的差异时间, 单位为 10^(-6) 秒。
也可以检查一下BIOS时间与Linux系统时间的差异,就是/var/lib/ntp/drift的内容,就能了解到Linux系统时间与BIOS硬件时钟到底差多久?单位为 10^(-6) 秒
下面的从http://www.meinberg.de/english/info/ntp.htm上摘下来的,详细说明了ntpq -p输出的每个列的意思,reach列为377表示前8次同步都成功。
Checking the NTP Status
The command line utility ntpq can be used to check the status of a NTP daemon on either the local machine or on a remote host.
ntpq can be run in an interactive mode or in batch mode. In batch mode, ntpq executes a command and returns to the command prompt. The parameter -p (‘peers’) lets ntpq print the status of a NTP daemon. Enter
ntpq -p
to display the status of the daemon on the local machine, or
ntpq -p ntp_server
to display the status of the daemon on the remote host ntp_server. The command should print a table with one status line for each reference time source which has been configured for the NTP daemon on the specified host:
remote refid st t when poll reach delay offset jitter
=======================================================================
LOCAL(0) LOCAL(0) 12 l 30 64 377 0.000 0.000 0.000
*GENERIC(0) .DCFa. 0 – 24 64 377 0.000 0.050 0.003
+172.16.3.103 .PPS. 1 u 36 64 377 1.306 -0.019 0.043
The table above shows the output for a NTP daemon which has 3 reference time sources: its own local clock, a DCF77 radio clock as refclock-0, plus an NTP daemon on the network, with IP address 172.16.3.103.
If the first character of a line is not blank then it contains a qualifier for the corresponding reference time source. Immediately after the daemon has been started all qualifiers are blank. The NTP daemon needs several polling cycles to check the available time sources and declare one of them as the reference it synchronizes to.
An asterisk * in the first column marks the reference time source which is currently preferred by the NTP daemon, the + character marks high quality candidates for the reference time which could be used if the currently selected reference time source should become unavailable.
The column remote displays the IP address or the host name of the reference time source, where LOCAL refers to the local clock. The refid shows the type of the reference clock, where e.g. LOCAL or LCL refers to the local clockagain, .DCFa. refers to a standard DCF77 time source, and .PPS. indicates that the reference clock is disciplined by a hardware pulse-per-second signal. Other identifiers are possible, depending on the type of the reference clock.
The column st reflects the stratum number of the reference time source. In the example above, the local clock has stratum 12, the remote time server at 172.16.3.103 has stratum 1 which is the best you can see across the network, and the local radio clock has stratum 0, so the radio clock is currently being preferred.
Every time a when count reaches the poll number in the same line, the NTP daemon queries the time from the corresponding time source and resets the when count to 0. The query results of each polling cycle are filtered and used as a measure for the clock’s quality and reachability.
The column reach shows if a reference time source could be reached at the last polling intervals, i.e. data could be read from the reference time source, and the reference time source was synchronized. The value must be interpreted as an 8 bit shift register whose contents is for historical reasons displayed as octal values. If the NTP daemon has just been started, the value is 0. Each time a query was successful a ‘1’ is shifted in from the right, so after the daemon has been started the sequence of reach numbers is 0, 1, 3, 7, 17, 37, 77, 177, 377. The maximum value 377 means that the eight last queries were completed successfully.
Queries are considered successful if data can be received from the time source, and the time source in turn claims to be synchronized to some other timesource. In case of a hardware reference clock this means the query considered unsuccessful if the hardware reference clock is not synchronized to its incoming time signal, e.g. because the clock’s antenna has been disconnected, or if no data can be received e.g. because the serial cable to an external device has been disconnected.
The NTP daemon must have reached a reference time source several times (reach not 0) before it selects a preferred time source and puts an asterisk in the first column.
The columns delay, offset and jitter show some timing values which are derived from the query results. In some versions of ntpq the last column is labeled disp (for dispersion) instead of jitter. All values are in in milliseconds. The delay value is derived from the roundtrip time of the queries. The offset value shows the difference between the reference time and the system clock. The jitter value indicates the magnitude of jitter between several time queries.
mgr是什么意思?
MySQL Group Replication(下简称MGR)准确来说是官方推出的高知可用解决方案,基于原生复制技术,并以插件的方式提供。
1、使用前,关掉防火墙,包括 selinux,firewalld,或者 MySQL 企业版的firewall(如果用了企业版的话)2、两台机器:(4 台 MySQL 实例)192.168.2.219 centos-ytt57-1 3311/3312192.168.2.229 centos-ytt57-2 3311/33123、安装 MySQL(两台都装), MySQL Shell(任意一台), mysqlrouter(任意一台,官方建议和应用程序装在一个服务器上)yum install mysql-community-server mysql-shell mysql-router-community
4、搭建 InnoDB-Cluster(两台都装)
1. 配置文件如下:shell>vi /etc/my.cnfmaster-info-repository=tablerelay-log-info-repository=tablegtid_mode=ONenforce_gtid_consistency=ONbinlog_checksum=NONElog_slave_updates=ONbinlog_format=ROWtransaction_write_set_extraction=XXHASH642. 系统 HOSTS 配置(两台都配)
shell>vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.219 centos-ytt57-2
192.168.2.229 centos-ytt57-3
用 MySQL coalesce 函数确认下 report-host 是否设置正确(root@localhost) : >SELECT coalesce(@@report_host, @@hostname) as r;+—————-+| r |+—————-+| centos-ytt57-1 |+—————-+1 row in set (0.00 sec)
3. 创建管理员用户搭建 GROUP REPLICATION (四个节点都要)
create user root identified by ‘Root@123’;grant all on *.* to root with grant option;flush privileges;
4. MySQLsh 连接其中一台节点:
# mysqlsh root@localhost:3321
5. 检查配置正确性:(如果这里不显示 OK,把对应的参数加到配置文件重启 MySQL 再次检查)dba.checkInstanceConfiguration(“root@centos-ytt57-2:3311”);dba.checkInstanceConfiguration(“root@centos-ytt57-2:3312”);dba.checkInstanceConfiguration(“root@centos-ytt57-3:3311”);dba.checkInstanceConfiguration(“root@centos-ytt57-3:3312”);mysqlsh 执行检测
# mysqlsh –log-level=8 root@localhost:3311
MySQL localhost:3311 ssl JS > dba.checkInstanceConfiguration(“root@centos-ytt57-2:3311”)
{
“status”: “ok”
}
6. 创建集群,节点 1 上创建。(结果显示 Cluster successfully created 表示成功)
MySQL localhost:3311 ssl JS > var cluster = dba.createCluster(‘ytt_mgr’);
Cluster successfully created. Use Cluster.addInstance() to add MySQL instances.
At least 3 instances are needed for the cluster to be able to withstand up to
one server failure.
7. 添加节点 2,3,4(全部显示 OK,表示添加成功)MySQL localhost:3311 ssl JS > cluster.addInstance(‘root@centos-ytt57-2:3312’);MySQL localhost:3311 ssl JS > cluster.addInstance(‘root@centos-ytt57-3:3311’);MySQL localhost:3311 ssl JS > cluster.addInstance(‘root@centos-ytt57-3:3312’);
8. 查看拓扑图:(describe 简单信息,status 详细描述)
MySQL localhost:3311 ssl JS > cluster.describe()
{
“clusterName”: “ytt_mgr”,
“defaultReplicaSet”: {
“name”: “default”,
“topology”: ,
“topologyMode”: “Single-Primary”
}
}
MySQL localhost:3311 ssl JS > cluster.status()
“clusterName”: “ytt_mgr”,
“defaultReplicaSet”: {
“name”: “default”,
“primary”: “centos-ytt57-2:3311”,
“ssl”: “REQUIRED”,
“status”: “OK”,
“statusText”: “Cluster is ONLINE and can tolerate up to ONE failure.”,
“topology”: {
“centos-ytt57-2:3311”: {
“address”: “centos-ytt57-2:3311”,
“mode”: “R/W”,
“readReplicas”: {},
“role”: “HA”,
“status”: “ONLINE”,
“version”: “8.0.17”
},
“centos-ytt57-2:3312”: {
“address”: “centos-ytt57-2:3312”,
“mode”: “R/O”,
“readReplicas”: {},
“role”: “HA”,
“status”: “ONLINE”,
“version”: “8.0.17”
},
“centos-ytt57-3:3311”: {
“address”: “centos-ytt57-3:3311”,
“mode”: “R/O”,
“readReplicas”: {},
“role”: “HA”,
“status”: “ONLINE”,
“version”: “8.0.17”
},
“centos-ytt57-3:3312”: {
“address”: “centos-ytt57-3:3312”,
“mode”: “R/O”,
“readReplicas”: {},
“role”: “HA”,
“status”: “ONLINE”,
“version”: “8.0.17”
}
},
“topologyMode”: “Single-Primary”
},
“groupInformationSourceMember”: “centos-ytt57-2:3311”
9. 简单测试下数据是否同步
(root@localhost) : >create database ytt;
Query OK, 1 row affected (0.03 sec)
(root@localhost) : >use ytt;
Database changed
(root@localhost) : >create table p1(id int primary key, log_time datetime);
Query OK, 0 rows affected (0.08 sec)
(root@localhost) : >insert into p1 values (1,now());
Query OK, 1 row affected (0.04 sec)
(root@localhost) : >show master status;
+—————+———-+————–+——————+——————————————-+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+—————+———-+————–+——————+——————————————-+
| mysql0.000001 | 25496 | | | 6c7bb9db-b759-11e9-a9c0-0800276cf0fc:1-41 |
+—————+———-+————–+——————+——————————————-+
1 row in set (0.00 sec)
查看其他三个节点
(root@localhost) : >show tables;
+—————+
| Tables_in_ytt |
+—————+
| p1 |
+—————+
1 row in set (0.00 sec)
(root@localhost) : >select * from p1;
+—-+———————+
| id | log_time |
+—-+———————+
| 1 | 2019-08-05 16:44:20 |
+—-+———————+
1 row in set (0.00 sec)
停掉主节点:# systemctl stop mysqld@0
现在查看,主节点已经变为本机 3312节点”centos-ytt57-2:3312″: { “address”: “centos-ytt57-2:3312”, “mode”: “R/W”, “readReplicas”: {}, “role”: “HA”, “status”: “ONLINE”}
10. 报错处理
错误日志里显示2019-08-05T09:01:35.125591Z 0 Plugin group_replication reported: ‘The group name option is mandatory’2019-08-05T09:01:35.125622Z 0 Plugin group_replication reported: ‘Unable to start Group Replication on boot’
同时用 cluster.rescan() 扫描,发现The instance ‘centos-ytt57-2:3311’ is no longer part of the ReplicaSet.
重新加入此节点到集群:cluster.rejoinInstance(‘centos-ytt57-2:3311’)
再次执行cluster.status()查看集群状态:”status”: “OK”,11. 移除和加入cluster.removeInstance(“centos-ytt57-3:3312”);The instance ‘centos-ytt57-3:3312’ was successfully removed from the cluster.cluster.addInstance(“centos-ytt57-3:3312”);The instance ‘centos-ytt57-3:3312’ was successfully added to the cluster.
12. 用 mysqlrouter 生成连接 MGR 相关信息。涉及到两个用户:–user=mysqlrouter 是使用mysqlrouter的系统用户自动创建的MySQL 用户是用来与MGR通信的用户。如果想查看这个用户的用户名以及密码,就加上–force-password-validation,不过一般也没有必要查看。
Redhat Linux默认的文件系统是什么格式?
现在Redhat Linux默认的文件系统格式是ext4。可以通过如下多种方法查询文件系统类型
1. mount
:~$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro,user_xattr)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
none on /var/lib/ureadahead/debugfs type debugfs (rw,relatime)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/kysnail/.gvfs type fuse.gvfs-fuse-daemon
(rw,nosuid,nodev,user=kysnail)
:~$
2. df
:~$ df -lhT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/sda1 ext4 19G 11G 7.8G 57% /
none devtmpfs 498M 248K 497M 1% /dev
none tmpfs 502M 252K 501M 1% /dev/shm
none tmpfs 502M 96K 502M 1% /var/run
none tmpfs 502M 0 502M 0% /var/lock
none tmpfs 502M 0 502M 0% /lib/init/rw
none debugfs 19G 11G 7.8G 57% /var/lib/ureadahead/debugfs
:~$
3. fdisk
:~$ sudo fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).
Command (m for help): c
DOS Compatibility flag is not set
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): p
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00077544
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 40105983 20051968 83 Linux
/dev/sda2 40108030 41940991 916481 5 Extended
/dev/sda5 40108032 41940991 916480 82 Linux swap / Solaris
Command (m for help): q
4. file
:~$ sudo file -s /dev/sda
/dev/sda: x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 2048,
40103936 sectors; partition 2: ID=0x5, starthead 254, startsector 40108030, 1832962 sectors,
code offset 0x63
kysnail@ubunkysnail:~$ sudo file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=4942da40-8a49-4bfd-9dc2-45c906d48413 (needs
journal recovery) (extents) (large files) (huge files)
:~$
5. parted
:~$ sudo parted
GNU Parted 2.2
使用 /dev/sda
欢迎使用 GNU Parted! 输入 ‘help’可获得命令列表.
(parted) p
Model: VMware, VMware Virtual S (scsi)
磁盘 /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
分区表:msdos
数字 开始: End 大小 类型 文件系统 标志
1 1049kB 20.5GB 20.5GB primary ext4 启动
2 20.5GB 21.5GB 938MB extended
5 20.5GB 21.5GB 938MB logical linux-swap(v1)
(parted)
6. 查看 fstab
# /etc/fstab: static file system information.
#
# Use ‘blkid -o value -s UUID’ to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
#
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=4942da40-8a49-4bfd-9dc2-45c906d48413 / ext4 errors=remount-ro,user_xattr
0 1
# swap was on /dev/sda5 during installation
UUID=935fb95d-771f-448e-9d23-4820106e1783 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
how long 造句?
I wonder how long Sheldon's got.
我想知道谢尔顿还有多久才崩溃。
Tabitha wondered how long the woman had been scratching a living on the waterways.
塔比瑟不知道那个女人已经靠这条水道坚持生活多久了。
How long does it take for him to recover remains a mystery/is still unclear.
他什么时候能够康复还是个未知数。