千夜同学 看脚下一片黑暗 望头顶星光璀璨

SaltStack 开发遇到的问题

| Python SaltStack

开发 SaltStack 的 Web 界面,遇到一个神奇的问题:

通过 Python 调用 salt-api 没有返回值,直到超时,并且后端打印 DEBUG 日志:

saltstack开发遇到的问题1.png

会提示机器链接不上,而且机器 hostname 是被拆分开的。

 READ MORE 

Python 升级导致 yum 命令无法使用的解决办法

| Python

报错信息如下

[root@develop local]# yum -y install prce  
There was a problem importing one of the Python modules  
required to run yum. The error leading to this problem was:  

No module named yum  

Please install a package which provides this module, or  
verify that the module is installed correctly.  
It's possible that the above module doesn't match the  
current version of Python, which is:  
2.6.1 (r261:67515, Aug 7 2010, 11:36:17)  
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]  
If you cannot solve this problem yourself, please go to  
the yum faq at:  
http://wiki.linux.duke.edu/YumFaq
 READ MORE 

Error Can't set headers after they are sent

| Node.js

NodeJS 启动,出现如下报错。

Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:335:11)
at ServerResponse.header (/server/node/opstools/node_modules/express/lib/response.js:700:10)
at ServerResponse.send (/server/node/opstools/node_modules/express/lib/response.js:154:12)
at fn (/server/node/opstools/node_modules/express/lib/response.js:934:10)
at View.exports.renderFile [as engine] (/server/node/opstools/node_modules/ejs/lib/ejs.js:353:10)
at View.render (/server/node/opstools/node_modules/express/lib/view.js:93:8)
at EventEmitter.app.render (/server/node/opstools/node_modules/express/lib/application.js:566:10)
at ServerResponse.res.render (/server/node/opstools/node_modules/express/lib/response.js:938:7)
at /server/node/opstools/app.js:43:9
at Layer.handle_error (/server/node/opstools/node_modules/express/lib/router/layer.js:58:5)
 READ MORE 

为什么寄存器比内存快

|

计算机的存储层次(memory hierarchy)之中,寄存器(register)最快,内存其次,最慢的是硬盘。

存储层次.png

 READ MORE 

交换分区设置

| Linux
[root@rhce ~]# cat /proc/sys/vm/swappiness
60

该值默认为 60。

swappiness=0 的时候,表示最大限度使用物理内存,然后才使用 swap 空间。

swappiness=100 的时候,表示积极的使用 swap 分区,并且把内存上的数据及时的搬运到 swap 空间中。

现在服务器的内存动不动就是上百 G,所以我们可以把这个参数值设置的低一些,让操作系统尽可能的使用物理内存,降低系统对 swap 的使用,从而提高系统的性能。

修改 swappiness 参数有临时修改和永久修改两种方法:

临时修改:

[root@rhce ~]# sysctl vm.swappiness=10
vm.swappiness = 10
[root@rhce ~]# cat /proc/sys/vm/swappiness
10

这里我们的修改已经生效,但是如果我们重启了系统,又会变成 60。

 READ MORE 

Linux 升级 Glibc

| Linux

下载安装包

wget http://ftp.gnu.org/gnu/glibc/glibc-2.15.tar.gz
wget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz

解压

tar -xvf  glibc-2.15.tar.gz
tar -xvf  glibc-ports-2.15.tar.gz
 READ MORE 

阿里云主机新加磁盘并格式化

| Linux

新加了一块磁盘

[root@iZ2zeh0wl8jq1asl4b3rf2Z ~]# fdisk -l
Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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 label type: dos
Disk identifier: 0x0008de3e

Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83884031    41940992   83  Linux

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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
 READ MORE 

Invalid command 'Order' perhaps misspelled or defined by a module not included in the server configuration

| Apache

报错是

Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration
 READ MORE 

Linux 查看网卡 UUID

| Linux

通过 nmcli 命令

[root@master test]# nmcli con
名称    UUID                                  类型            设备
ens33   c96bc909-188e-ec64-3a96-6a90982b08ad  802-3-ethernet  ens33
virbr0  7f06cd4d-a01e-4ba9-a5f8-494179118ee6  bridge          virbr0
 READ MORE