Solve activation of network connection failed技术
长假后的第一天,流量恢复的第一天。
最近在连接的时候报了个错“activation of network connection failed”,搞了半天没解决。本来想用命令行的方式去做,后来发现 NetworkManager 有提供简洁的 UI,于是使用桌面去做,最后却一直报错。
尝试了很多方法,依然不行,于是尝试更新系统。
$ sudo pacman -Syyu
更新出现 signature from ... is unknown trust 的错误,最后强制修改 pacman.conf,将 SigLevel 值修改为 Optional TrustAll 解决。系统更新好了,一切 OK!
Wincachegrind Cannot find all target技术
最近用了两个工具,一个 webgrind 一个 wincachegrind。发现两个都是不能用的软件。
使用 wincachegrind 解析 XDebug trace 文件出现报错。
Parser error: At this point at least main instance is expected. cachegrind.out line number: 2680 CurInst: NULL Stack: empty Call buffer: empty
然后使用 wincachegrind 解析 cachegrind.out 文件,依然报错。
Wincachegrind Cannot find all target
OpenResty Lua Redis 加速接口响应技术
本文以完整的示例,展示使用 Nginx、Lua、Redis 对响应速度慢的接口进行加速响应,提供快速的用户体验。代码经过严格的测试,没有任何问题。缓存的核心思想在于读取缓存后,即时中断连接,返回结果,然后继续执行,更新缓存。可以缓存的接口一般都是与用户无关的接口,比如计算当日热度最高的商品排行等。
需要加速的接口代码,如下示例:
<?php
sleep(2);
echo 'sleep 2 seconds, date is '.date("Y-m-d H:i:s")."\n";
测试接口访问效果,需要等待 2 秒后才能返回结果,如下示例:
$ curl -XGET lua.may:90/test.php sleep 2 seconds, date is 2017-09-19 10:44:58
Linux 下用户组别权限的理解技术
本篇讲述 Linux 用户组别权限的理解,希望给大家带来帮助。
先看操作历史记录。
Last login: Thu Aug  3 03:31:18 2017 from 202.101.22.42
root@may:~# groups root
root : root
root@may:~# groups sudo
groups: sudo: no such user
root@may:~# groups www-data
www-data : www-data
root@may:~# usermod -G www-data root
You have new mail in /var/mail/root
root@may:~# groups www-data
www-data : www-data
root@may:~# exit
logout
Connection to lmlphp.com closed.
Last login: Thu Aug  3 04:29:46 2017 from 202.101.22.42
root@may:~# groups www-data
www-data : www-data
root@may:~# groups root
root : root www-data
root@may:~# usermod --help
Usage: usermod [options] LOGIN
Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append                  append the user to the supplemental GROUPS
                                mentioned by the -G option without removing
                                him/her from other groups
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the
                                new location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
  -v, --add-subuids FIRST-LAST  add range of subordinate uids
  -V, --del-subuids FIRST-LAST  remvoe range of subordinate uids
  -w, --add-subgids FIRST-LAST  add range of subordinate gids
  -W, --del-subgids FIRST-LAST  remvoe range of subordinate gids
  -Z, --selinux-user SEUSER     new SELinux user mapping for the user account
root@may:~# group
groupadd  groupdel  groupmod  groups
root@may:~# groupdel --help
Usage: groupdel [options] GROUP
Options:
  -h, --help                    display this help message and exit
  -R, --root CHROOT_DIR         directory to chroot into
You have new mail in /var/mail/root
root@may:~# man groupdel
-bash: man: command not found
root@may:~# vim /etc/passwd
You have new mail in /var/mail/root
root@may:~# groups
root www-data
root@may:~# vim /etc/group
root@may:~# usermod -G lin root
root@may:~# groups
root www-data
root@may:~# groups root
root : root lin
root@may:~# groups www-data
www-data : www-data
root@may:~# groups lin
lin : lin sudo
root@may:~# groups
root www-data
root@may:~# groups root
root : root lin
root@may:~# exit
logout
Connection to lmlphp.com closed.
Welcome to Ubuntu 14.04 LTS (GNU/Linux 2.6.32-042stab108.8 x86_64)
 * Documentation:  https://help.ubuntu.com/
You have new mail.
Last login: Thu Aug  3 04:31:07 2017 from 202.101.22.42
root@may:~# groups
root lin
root@may:~# groups root
root : root lin
root@may:~# usermod -G www-data root
root@may:~# groups
root lin
root@may:~# groups root
root : root www-data
root@may:~#
代码构建发布系统核心代码技术
代码构建发布系统,市场上有无数个,一般 python 的居多,因为运维也就会点 python。不论哪种代码发布系统,核心代码都是一样的,就是使用了 Linux 的 rsync 功能。连核心功能都是系统自带的,那就应该是没有核心吧。
如下 rsync 示例:
sprintf( 'rsync -rltgoDzvO %s %s %s %s' , TMP_DIR , TARGET_DIR , (DELETE_FILES) ? '--delete-after' : '' , $exclude );
由此可见,发布系统并没有核心技术,其核心是系统自带的 rsync 功能,真正的核心也就一行代码,只是外面套了一层又一层的皮而已。比如加上了 web 界面,与各种版本控制功能相互融洽结合。