进程控制(二)与linux下的自有服务

一.进程动态信息查看top

第一部分 统计信息

[root@yunwei1 ~]# top
top - 19:22:52 up 1:32, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 106 total, 1 running, 105 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.1%sy, 0.0%ni, 99.6%id, 0.0%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 1004112k total, 220464k used, 783648k free, 22328k buffers
Swap: 2031612k total, 0k used, 2031612k free, 85752k cached

load average: 0.00, 0.00, 0.00为1分钟,5分钟,15分钟内的平均负载,一般1以内的值比较合适,偏高说明有较多的进程在等待使用CPU资源

计算方法
平均负载 / 逻辑cpu数量

物理CPU(N路):主板上CPU插槽的个数
CPU核数:一块CPU上面能处理数据的芯片组的数量
逻辑CPU:一般情况,一颗cpu可以有多核,加上intel的超线程技术(HT), 可以在逻辑上再分一倍数量的cpu core出来;逻辑CPU数量=物理cpu数量 x cpu核数。如果支持HT,还要更多。

查看物理CPU的个数
# cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
查看逻辑CPU的个数
# cat /proc/cpuinfo |grep "processor"|wc -l
查看CPU是几核
# cat /proc/cpuinfo |grep "cores"|uniq

CPU的运行状况

us    用户进程占用CPU的比率
sy    内核、内核进程占用CPU的比率;
ni    如果一些用户进程修改过优先级,这里显示这些进程占用CPU时间的比率;
id    CPU空闲比率,如果系统缓慢而这个值很高,说明系统慢的原因不是CPU负载高;
wa    CPU等待执行I/O操作的时间比率,该指标可以用来排查磁盘I/O的问题,通常结合wa和id判断
hi    CPU处理硬件中断所占时间的比率;
si    CPU处理软件中断所占时间的比率;
st    其他任务所占CPU时间的比率;

 

说明:
1. 用户进程占比高,wa低,说明系统缓慢的原因在于进程占用大量CPU,通常还会伴有教低的id,说明CPU空闲时间很少;
2. wa低,id高,可以排除CPU资源瓶颈的可能。
3. wa高,说明I/O占用了大量的CPU时间,需要检查交换空间的使用;如果内存充足,但wa很高,说明需要检查哪个进程占用了大量的I/O资源。

第二部分 进程信息

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4 root 20 0 0 0 0 S 1.9 0.0 0:00.09 ksoftirqd/0
1542 root 20 0 163m 7868 4476 S 1.9 0.8 0:11.51 vmtoolsd
1 root 20 0 19348 1556 1232 S 0.0 0.2 0:02.75 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreaddtop常用按键说明
1(数字) 显示所有的CPU负载
M 按内存占用排序
P 按CPU的占用排序
T 按使用CPU的时间累积排序
R 逆序展示
k 向指定进程发出信号
s 设置多久刷新一次数据
r 设置优先级
q 退出top

 

top常用选项
-d n 指定多久两次刷屏的时间间隔为n秒
-p pid 只看进程号为pid的进程信息
-u 用户名 指定查看某个用户的进程
-b -n 以批处理方式执行top命令。通常使用数据流重定向,将处理结果输出为文件;

案例如下
[root@yunwei1 proc]# top -2
top - 19:51:59 up 2:01, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 106 total, 1 running, 105 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.3%sy, 0.0%ni, 99.2%id, 0.3%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 1004112k total, 223996k used, 780116k free, 23280k buffers[root@yunwei1 proc]# top -d 2 -p 3198
top - 19:53:42 up 2:03, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.3%sy, 0.0%ni, 99.2%id, 0.3%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 1004112k total, 225044k used, 779068k free, 23308k buffers
Swap: 2031612k total, 0k used, 2031612k free, 88404k cachedPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 
3198 root 20 0 52132 812 260 S 0.0 0.1 0:00.00 vsftpd

 

二.进程控制

1.进程的优先级控制

(一)调整正在运行进程的优先级(renice)

(1)优先级范围

-20--19,值越小,优先级越大,系统会给更多的CPU时间给该进程

(2)使用renice调整

renice 优先级值(-20-19) 进程ID

[root@yunwei1 proc]# ps aux|grep vsftpd
root 3198 0.0 0.0 52132 812 ? Ss 19:52 0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 3214 0.0 0.0 103332 844 pts/0 S+ 19:56 0:00 grep vsftpd
[root@yunwei1 proc]# renice -5 3198
3198: old priority 0, new priority -5
[root@yunwei1 proc]#

 

(二)程序运行时指定nice值

nice -n 优先级值(-20-19) 需要运行的进程==

启动进程时,通常会继承父进程的 nice级别,默认为0。

[root@yunwei1 proc]# nice -n -10 service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@yunwei1 proc]# ps aux |grep vsftpd
root 3302 0.0 0.0 52132 808 ? S<s 20:01 0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 3305 0.0 0.0 103332 844 pts/0 S+ 20:01 0:00 grep vsftpd
[root@yunwei1 proc]# top -d 2 -p 3302
top - 20:02:06 up 2:12, 2 users, load average: 0.06, 0.02, 0.00
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.3%sy, 0.0%ni, 99.3%id, 0.3%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 1004112k total, 225276k used, 778836k free, 23436k buffers
Swap: 2031612k total, 0k used, 2031612k free, 88464k cachedPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3302 root 10 -10 52132 808 260 S 0.0 0.1 0:00.00 vsftpd

 

2.进程的运行状态控制

(一)如何控制进程的状态

通过发送信号来控制进程的状态

(二)常见的信号有哪些

| 信号编号 | 信号名 | 解释说明 |
| -------- | ------- | ------------------------------------------------------ |
| 1 | SIGHUP | 默认终止控制终端进程(可用来重新加载配置文件,平滑重启) |
| 2 | SIGINT | 键盘中断(ctrl+c) |
| 3 | SIGQUIT | 键盘退出(ctrl+\),一般指程序异常产生core文件 |
| 9 | SIGKILL | 强制终止 |
| 15 | SIGTERM | 正常结束,默认信号 |
| 18 | SIGCONT | 继续 |
| 19 | SIGSTOP | 停止 |
| 20 | SIGTSTP | 暂停(ctrl+z),一般子进程结束 |

(三)如何发送信号给进程

kill 信号 进程ID 该命令后面只能跟进程ID,不能跟进程名称
pkill 信号 服务名称 不能跟进程ID,
skill 信号 进程ID或服务名名称都可以
killall 信号 服务名称

[root@yunwei1 proc]# kill -15 vsftpd
-bash: kill: vsftpd: arguments must be process or job IDs
[root@yunwei1 proc]# kill -15 3302
[root@yunwei1 proc]# ps aux |grep vsftpd
root 3342 0.0 0.0 103332 840 pts/0 S+ 20:13 0:00 grep vsftpd[root@yunwei1 proc]# pkill -15 3361
[root@yunwei1 proc]# ps aux |grep vsftpd
root 3361 0.0 0.0 52132 804 ? Ss 20:14 0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 3366 0.0 0.0 103332 844 pts/0 S+ 20:14 0:00 grep vsftpd
[root@yunwei1 proc]# pkill -15 vsftpd
[root@yunwei1 proc]# ps aux |grep vsftpd
root 3371 0.0 0.0 103332 844 pts/0 S+ 20:14 0:00 grep vsftpd
[root@yunwei1 proc]#

[root@yunwei1 tmp]# ps aux|grep vsftpd
root 3485 0.0 0.0 52132 808 ? Ss 20:24 0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 3495 0.0 0.0 103332 844 pts/0 S+ 20:24 0:00 grep vsftpd
[root@yunwei1 tmp]# killall -15 3485
3485: no process killed
[root@yunwei1 tmp]# killall -15 vsftpd
[root@yunwei1 tmp]# ps aux|grep vsftpd
root 3499 0.0 0.0 103332 844 pts/0 S+ 20:24 0:00 grep vsftpd
[root@yunwei1 tmp]# 

 

(四)其他进程命令

&符号可以将进程放在后台运行

[root@yunwei1 tmp]# sleep 300 &
[1] 3506
[root@yunwei1 tmp]#

jobs 查看后台运行的进程
fg 将后台的进程放到前台执行
bg 将后台进程放到后台集训执行

案例如下

[root@yunwei1 tmp]# jobs
[2]- Running sleep 3000 &
[3]+ Running sleep 300 &
[root@yunwei1 tmp]#

[root@yunwei1 tmp]# ps aux|grep sleep
root 3536 0.0 0.0 100928 572 pts/0 S 20:30 0:00 sleep 3000
root 3543 0.0 0.0 100928 572 pts/0 S 20:33 0:00 sleep 300
root 3548 0.0 0.0 103332 844 pts/0 S+ 20:34 0:00 grep sleep
[root@yunwei1 tmp]# kill -19 3543 
[3]+ Stopped sleep 300
[root@yunwei1 tmp]# jobs
[2]- Running sleep 3000 &
[3]+ Stopped sleep 300
[root@yunwei1 tmp]# 
[root@yunwei1 tmp]# bg %3
[3]+ sleep 300 &
[root@yunwei1 tmp]# jobs
[2]- Running sleep 3000 &
[3]+ Running sleep 300 &
[root@yunwei1 tmp]# 
[root@yunwei1 tmp]# fg %3
sleep 300

 

三. 服务器的基本配置

1.主机名的配置

(一)查看主机名

hostname 命令可查看主机名
/etc/sysconfig/network 主机名配置文件

案例如下

[root@yunwei1 tmp]# hostname
yunwei1.heima.cc[root@yunwei1 tmp]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=yunwei1.heima.cc
[root@yunwei1 tmp]# 

 

(二)设置主机名

(1)临时设置

hostname 要修改的主机名可以临时设置,重启后失效

[root@yunwei1 tmp]# hostname hehe.com
[root@yunwei1 tmp]# hostname
hehe.com
[root@yunwei1 tmp]#

 

(2)永久设置

就该配置文件,重启系统后即可永久生效

[root@yunwei1 tmp]# vim /etc/sysconfig/network
[root@yunwei1 tmp]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=yunwei1.heima.cc
[root@yunwei1 tmp]# 

 


2.静态IP的设置

(一)网卡配置文件位置

目录/etc/sysconfig/network-scripts/下保存网络相关命令,网卡配置信息文件

(二)网卡配置文件基本内容

[root@yunwei1 tmp]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0 设备名称
TYPE=Ethernet 以太网
ONBOOT=yes 是否开机自启动
NM_CONTROLLED=yes 是否接受NetworkManger服务管理
BOOTPROTO=none 获取IP方式,none和static是静态获取,dhcp是动态分配
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
PEERDNS=yes
PEERROUTES=yes
LAST_CONNECT=1552268821
IPADDR=192.168.244.133 网卡的静态ip地址
NETMASK=255.255.255.0 子网掩码
GATEWAY=192.168.244.2 网关
DNS1=119.29.29.29 DNS服务器

 

(三)网卡设置静态IP

(1)文本图形界面设置

setup命令

(2)修改配置文件设置

vim /etc/sysconfig/network-scripts/ifcfg-eth0

(四)网络启动/重启

service network start/restart 启动/重启
或/etc/init.d/network start/restart 启动/重启
或ifup eth0 启动

案例如下

[root@yunwei1 tmp]# service network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2
[ OK ]
[root@yunwei1 tmp]# /etc/init.d/network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/3
[ OK ]

 

(五)其他网络相关指令

查看网卡相关信息命令
#ifconfig
#ip a
#ping ip地址 -c表示几次

案例

[root@yunwei1 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host 
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:4c:63:84 brd ff:ff:ff:ff:ff:ff
inet 192.168.244.133/24 brd 192.168.244.255 scope global eth0
inet6 fe80::20c:29ff:fe4c:6384/64 scope link 
valid_lft forever preferred_lft forever
[root@yunwei1 ~]#
[root@yunwei1 ~]# ping -c2 192.168.31.21
PING 192.168.31.21 (192.168.31.21) 56(84) bytes of data.
64 bytes from 192.168.31.21: icmp_seq=1 ttl=128 time=1.06 ms
64 bytes from 192.168.31.21: icmp_seq=2 ttl=128 time=0.738 ms--- 192.168.31.21 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.738/0.900/1.062/0.162 ms
[root@yunwei1 ~]#

 

3.防火墙和selinux

(一)查看防火墙状态信息

service iptables status
或/etc/init.d/iptables status
或iptables -L 列出防火墙上的规则信息

(二)关闭防火墙

(1)临时关闭

service iptables stop
或/etc/init.d/iptables stop

案例

[root@yunwei1 ~]# service iptables start
iptables: Applying firewall rules: [ OK ]
[root@yunwei1 ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]

 

(2)永久关闭

查看防火墙是否开机自启动
#chkconfig --list |grep iptables

关闭防火墙开机自启动
#chkconfig iptables off

案例

[root@yunwei1 ~]# chkconfig --list |grep iptables
iptables 0:off    1:off    2:off    3:off    4:off    5:off    6:off
[root@yunwei1 ~]#
[root@yunwei1 ~]# chkconfig --list |grep iptables
iptables 0:off    1:off    2:off    3:off    4:off    5:off    6:off
[root@yunwei1 ~]# chkconfig --level 35 iptables on
[root@yunwei1 ~]# chkconfig --list |grep iptables
iptables 0:off    1:off    2:off    3:on    4:off    5:on    6:off
[root@yunwei1 ~]# chkconfig iptables off
[root@yunwei1 ~]# chkconfig --list |grep iptables
iptables 0:off    1:off    2:off    3:off    4:off    5:off    6:off
[root@yunwei1 ~]#

 

(三)查看selinux模式

查看当前系统的selinux运行模式

[root@yunwei1 ~]# getenforce 
Disabled

当前系统的selinux运行模式可在/etc/selinux/config配置文件中查看

[root@yunwei1 ~]# cat /etc/selinux/config# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

注释说明:
enforcing模式表示安全级别最高,强制模式。
permissive模式表示警告模式,可以自由通过。
disabled表示没有启用selinux

 (四)关闭selinux

(1)临时设置到高级模式

setenforce命令可以临时设置
[root@yunwei1 ~]# setenforce 
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]
Permissive|0 高级模式[root@yunwei1 ~]# setenforce 0
setenforce: SELinux is disabled
[root@yunwei1 ~]# 

 

(2)永久关闭

vim /etc/selinux/config[root@yunwei1 ~]# vim /etc/selinux/config 
[root@yunwei1 ~]# cat /etc/selinux/config# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted 

配置文件修改后,需要下次重启后才能生效

4.系统其它信息查看

(一)系统版本

[root@yunwei1 ~]# lsb_release -d
Description:    CentOS release 6.9 (Final)
[root@yunwei1 ~]#

[root@yunwei1 ~]# cat /etc/redhat-release 
CentOS release 6.9 (Final)

 

(二)内核版本

显示内核版本
[root@yunwei1 ~]# uname -r
2.6.32-696.el6.x86_64
显示主机名
[root@yunwei1 ~]# uname -n
yunwei1.heima.cc
显示内核名
[root@yunwei1 ~]# uname -s
Linux
[root@yunwei1 ~]# uname -i
x86_64

(三)磁盘挂载情况

查看当前已经挂在的磁盘信息

[root@yunwei1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
18G 5.4G 11G 34% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 477M 36M 417M 8% /boot
[root@yunwei1 ~]# 


查看当前系统所有设备信息

[root@yunwei1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 3.7G 0 rom 
sda 8:0 0 20G 0 disk 
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 19.5G 0 part 
├─VolGroup-lv_root (dm-0) 253:0 0 17.6G 0 lvm /
└─VolGroup-lv_swap (dm-1) 253:1 0 2G 0 lvm [SWAP]
[root@yunwei1 ~]# 

 

(四)内存信息查看

free -m 选项-m值以mb为单位

[root@yunwei1 ~]# free -m
total used free shared buffers cached
Mem: 980 228 751 0 24 88
-/+ buffers/cache: 115 865
Swap: 1983 0 1983
[root@yunwei1 ~]#

 

转载于:https://www.cnblogs.com/golinux/p/10809017.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/569473.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

CSS 图片上下部与边框有间隙

解决方法&#xff1a; img可能有默认样式&#xff0c;所以在CSS中&#xff0c;添加如下语句&#xff1a; img{border:0;vertical-align:top;vertical-align:bottom; }

spring注解-声明式事务

实现步骤&#xff1a; 1.导入依赖包&#xff1a;数据源 c3p0 , 数据库驱动&#xff1a;mysql-connector-java , spring事务包&#xff1a;这时导入spring-jdbc&#xff0c;该包依赖spring-tx, maven会自动导入依赖 <dependency><groupId>c3p0</groupId>…

float:left后,导航栏不左浮解决

float:left 导航栏左浮&#xff0c;但加入 width&#xff1a;50%后&#xff0c;本想达到下面效果&#xff1a; 但是&#xff0c;所有元素成一列&#xff0c;不左浮了 原因&#xff1a;可能是你加了边框&#xff0c;边框占像素&#xff0c;所以相当于把剩余的50%“挤下来了” …

单词统计

题目&#xff1a; 第0步&#xff1a;输出某个英文文本文件中 26 字母出现的频率&#xff0c;由高到低排列&#xff0c;并显示字母出现的百分比&#xff0c;精确到小数点后面两位。 第1步&#xff1a;输出单个文件中的前 N 个最常出现的英语单词。作用&#xff1a;一个用于统计文…

html 经常会用到的英语名词

avatar 头像 portfolio 作品集 mask 面罩 shiny-wrapper 包裹器 shiny-inner 内部

轻松自动化---selenium-webdriver(python) (四)

https://www.cnblogs.com/fnng/p/3190966.html http://www.testclass.net/ 测试教程网&#xff0c;专业的selenium 学习网站。 本节要解决的问题&#xff1a; 如何定位一组元素&#xff1f; 场景 从上一节的例子中可以看出&#xff0c;webdriver可以很方便的使用findElement方…

如何用CSS画一个三角形

border-left-color: border-top-width:中心距顶部距离 .userCard .welcome .triangle{ border: 8px solid transparent;width: 0px;height: 0px;border-left-color: #E8676B;border-top-width: 0; } 结果 → 这篇博客很清楚&#xff0c;可借助参考&#xff1a;https://…

CSS hr修改样式

hr 默认样式 若加上这样CSS hr{height: 0;border: none;border-top: 1px solid red; } 会变为

CSS height高度 和 width宽度

1、不到情非得已不要用height&#xff0c;height是bug的来源 2、内联元素的高度由 line-height 决定 3、块级元素的高度由 其内部文档流元素的高度总和决定 文档流&#xff1a;文档内元素的流动方向 4、max-width 是最大宽度&#xff0c;可以自适应&#xff0c;若屏幕小…

scrapy框架的日志等级和请求传参

Scrapy的日志等级 - 在使用scrapy crawl spiderFileName运行程序时&#xff0c;在终端里打印输出的就是scrapy的日志信息。- 日志信息的种类&#xff1a;ERROR &#xff1a; 一般错误WARNING : 警告INFO : 一般的信息DEBUG &#xff1a; 调试信息- 设置日志信息指定输出&#x…

绝对定位absolute、相对定位relative(脱离文档流)

1、脱离文档流&#xff0c;&#xff1a;父元素高度不再包含文档流高度 position&#xff1a;absolute 子元素 position&#xff1a;relative 父元素&#xff0c; 子元素相对于祖先中的第一个relative定位&#xff0c;用到的 top:0; left:0; 不然出bug 2、相对于屏幕…

第32月第8天 打包 Framework 时使用 CocoaPods 引入第三方库的方法

1. 但是可以发现打包完后的 .framework 包里面是没有 CocoaPods 集成的第三方库的&#xff0c;所以在使用 .framework 包时&#xff0c;工程中必须也要集成 .framework 包中用到的第三方库&#xff0c;否则会找不到文件而报错。 https://www.cnblogs.com/nelsen-chen/p/9353520…

CSS 加过渡效果transition

transition: box-shadow 0.3s; 给按钮加效果 transition: all 0.7s; 给进度条

php后端语言的基本语法

<?php$num 1;//php中定义一个变量echo $num;//php中打印一个值&#xff08;与console。log类似&#xff09;$arr array(1,2,3,4,5,6,7,89);//在php中定义一个数组//echo $arr;php中使用echo不能输出集合&#xff08;数组与对象&#xff09;&#xff0c;//必须采用print_r…

CSS居中问题

1.左浮后&#xff0c;想居中&#xff1a; 给他“爸爸”居中&#xff0c;如果没有宽度&#xff0c;不能用 margin&#xff1a;0 auto;可以用text-align&#xff1a;center&#xff1b; 2.继1&#xff0c;如果“爸爸”也没有确定的宽&#xff0c;想变窄 “爸爸”只能也变成 di…

12-order by和group by 原理和优化 sort by 倒叙

原理和优化 groupBy分组&#xff1f;会造成一个数据倾斜 1.解决方案&#xff1a;将输入在map端进行部分的打乱重分 set hive.groupby.skewindatatrue; 2.在map到reduce端的时候设置combiner进行合并 set hive.map.aggrtrue; 3.在combiner进行合并的时候要知道数据量的大小&…

内联元素(display:inline-block)注意事项

1.内联元素margin的上下没有用&#xff0c;加入 display:inline-block 后&#xff0c;才有用&#xff1b; 不是block块级元素了&#xff0c;那么想居中&#xff0c;用 margin&#xff1a;0 auto; 没用了&#xff0c; 那想居中&#xff0c;在他“父亲”加上 text-align&#x…

多个excel文件内容合并到一个excel文件的多个sheet的小程序

# -*- coding:utf-8 -*-import xlrd, xlsxwriter# 待合并excelallxls ["D:\\excelcs\\***.xlsx"]allxls1 ["D:\\excelcs\\***.xlsx"]allxls2 ["D:\\excelcs\\***.xlsx"]#print(allxls[0:2])# 目标excelend_xls "D:\\excelcs\\***.xlsx&…

【编程训练-考研上机模拟】综合模拟2-2019浙大上机模拟(晴神)

A - next[i] Problem Description 在字符串匹配的KMP算法中有一个重要的概念是next数组&#xff0c;求解它的过程让不少同学伤透了心。next数组的直接语义其实是&#xff1a;使“长度为L的前缀”与“长度为L的后缀”相同的最大L&#xff0c;且满足条件的前后缀不能是原字符串本…

CSS常用工具

wall haven 墙纸 CSS tricks shape 用CSS作图 iconfont.cn 小图标工具网站&#xff0c;&#xff08;添加至项目→symbol→查链接→生成代码→<script>→使用帮助&#xff09; CSS3 linear gradient &#xff08;generator&#xff09; 线性渐变工具 CSS animation…