第一个问题,FreeBSD 10 之後的版本改用unbound 代替了bind
所以已經沒有 nslookup , dig 等指令
可以改用host , drill 等指令
但如果還是習慣 nslookup的話
可以安裝bind-tools 套件

#cd /usr/ports/dns/bind-tools
#make install

安裝完後看看是否真的出現
# which nslookup
/usr/local/bin/nslookup

From:http://blog.sina.com.tw/helloworld/article.php?entryid=651089

cd /usr/ports/devel/git/ && make install clean
nc FreeBSD自带,而netcat需要自己安装,如下:
cd /usr/ports/net/netcat/ && make install clean

第二个问题,关于CentOS如何只知道命令不知道哪个包,而通过YUM的provides命令反查nslookup所在的软件包的?

32:bind-utils-9.9.4-51.el7.x86_64 : Utilities for querying DNS name servers
源    :updates
匹配来源:
文件名    :/usr/bin/nslookup

yum provides *bin/nslookup

32:bind-utils-9.9.4-38.el7_3.3.x86_64 : Utilities for querying DNS name servers
源    :@updates
匹配来源:
文件名    :/usr/bin/nslookup

================================================

nslookup這個指令對於網路除錯來說,應該是很多人都很習慣的工具
如果發現安裝好的Linux系統少了這個指令

[root@example ~]# nslookup myip.pass.tw
-bash: nslookup: command not found

[root@example ~]# which nslookup
/usr/bin/which: no nslookup in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

直接安裝看看咧? 找不到這個套件名稱
[root@example ~]# yum -y install nslookup
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
No package nslookup available.
Error: Nothing to do

試試 yum provides 看看nslookup 是包含在哪個套件中
[root@example ~]# yum provides nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
Warning: 3.0.x versions of yum would erroneously match against filenames.
You can use "*/nslookup" and/or "*bin/nslookup" to get that behaviour
No Matches found

依提示再搜尋一下,可以發現包含在bind-utils 套件中
[root@example ~]# yum provides */nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
base/filelists_db                                                                                                                                                                                                     | 6.4 MB     00:00
epel/filelists_db                                                                                                                                                                                                     | 7.7 MB     00:01
extras/filelists_db                                                                                                                                                                                                   |  25 kB     00:00
updates/filelists_db                                                                                                                                                                                                  | 1.5 MB     00:00
zsh-4.3.11-4.el6.centos.2.x86_64 : A powerful interactive shell
Repo        : base
Matched from:
Filename    : /usr/share/zsh/4.3.11/functions/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo        : base
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.2.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.1.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

[root@example ~]# yum provides *bin/nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirrors.kernel.org
* extras: mirrors.linode.com
* updates: mirrors.linode.com
32:bind-utils-9.8.2-0.62.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo        : base
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.2.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.1.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

安裝 bind-utils
[root@example ~]# yum -y install bind-utils
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirrors.kernel.org
* extras: mirrors.linode.com
* updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.x86_64 32:9.8.2-0.62.rc1.el6_9.4 will be installed
--> Processing Dependency: bind-libs = 32:9.8.2-0.62.rc1.el6_9.4 for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: liblwres.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisccfg.so.82()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisccc.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisc.so.83()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libdns.so.81()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libbind9.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Running transaction check
---> Package bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
Package                                                Arch                                               Version                                                                 Repository                                           Size
=============================================================================================================================================================================================================================================
Installing:
bind-utils                                             x86_64                                             32:9.8.2-0.62.rc1.el6_9.4                                               updates                                             189 k
Installing for dependencies:
bind-libs                                              x86_64                                             32:9.8.2-0.62.rc1.el6_9.4                                               updates                                             892 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install       2 Package(s)

Total download size: 1.1 M
Installed size: 2.7 M
Downloading Packages:
(1/2): bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64.rpm                                                                                                                                                                    | 892 kB     00:00
(2/2): bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64.rpm                                                                                                                                                                   | 189 kB     00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                         44 MB/s | 1.1 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                                1/2
  Installing : 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                               2/2
  Verifying  : 32:bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                                1/2
  Verifying  : 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                               2/2

Installed:
  bind-utils.x86_64 32:9.8.2-0.62.rc1.el6_9.4

Dependency Installed:
  bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4

Complete!

来自:http://blog.sina.com.tw/helloworld/article.php?pbgid=170996&entryid=657249
背景:有的SSH连接提示 host key,很麻烦,如何取消。

两步:
一)删除先前的指纹文件:
来自文件:D:\Program Files\SecureCRT\ssh_tmp\SSH2.ini
文件里配置:S:"Host Key Database Location"=D:\Program Files\SecureCRT\ssh_tmp\KnownHosts\
上面的SSH2.ini有可能升级有多个,都统一找一下里面的路径并删除掉有newhostkey问题的IP.pub,都统一批量改成二)里面的配置项。
bash-shell下操作如下:
/d/Program Files/SecureCRT7.3/ssh_tmp/KnownHosts
删除掉:rm -rf '47.94.88.237[47.94.88.237]22.pub

二)配置文件修改,如下:
From:
D:"Automatically Accept Host Keys"=00000000
To:
D:"Automatically Accept Host Keys"=00000001

Save the change, restart SecureCRT.
D:\Program Files\SecureCRT\ssh_tmp\SSH2.ini

内容如下:
S:"Host Key Database Location"=D:\Program Files\SecureCRT\ssh_tmp\KnownHosts\
S:"Host Key Database Location V2"=${VDS_CONFIG_PATH}\KnownHosts\
D:"Automatically Accept Host Keys"=00000001

整个配置如下:
D:\Program Files\SecureCRT\ssh_tmp\SSH2.ini


来自:http://blog.csdn.net/warcraftzhaochen/article/details/73867385
在CentOS下面打Rpm包时用 make install DESTDIR=%{buildroot} ,而在FreeBSD下用make PREFIX=/usr/local/redis install 好像也成:

cd /usr/ports/databases/redis
make PREFIX=/usr/local/redis install

/usr/local/redis/bin/redis-server
/usr/local/redis/bin/redis-cli
/usr/local/redis/bin/redis-check-rdb
/usr/local/redis/bin/redis-benchmark
/usr/local/redis/bin/redis-sentinel

From:https://www.iyunv.com/thread-51148-1-1.html


最新版本5.0:
/usr/local/bin/gmake PREFIX=/usr/local/redis/ install clean
The MySQL server is running with the --read-only option so it cannot execute
解决办法:
mysql> set global read_only=0;
(关掉新主库的只读属性)
flush privileges;
set global read_only=1;(读写属相)
flush privileges;
出现:
The MySQL server is running with the --read-only option so it cannot execute

来自:http://www.cnblogs.com/xionghui/archive/2013/03/01/2939342.html
进程启动时指定CPU
命令taskset -c 1 ./redis-server ../redis.conf

taskset
taskset是LINUX提供的一个命令(ubuntu系统可能需要自行安装,schedutils package)。他可以让某个程序运行在某个(或)某些CPU上。


指定进程运行在某个特定的CPU上

命令taskset -pc 3 21184

显示结果:

pid 21184's current affinity list: 0-23
pid 21184's new affinity list: 3

注:3表示CPU将只会运行在第4个CPU上(从0开始计数)。


来自:http://blog.csdn.net/xluren/article/details/43202201
http://www.361way.com/linux-context-switch/5131.html
用途:用于查看当前服务器读写磁盘情况.
iostat -x 1


5  8781  0.0 /usr/lib64/sa/sadc -F -L -S DISK 1 1 -
  5   879  0.0 [kauditd]
  5  8950  0.0 CROND
  5  8951  0.0 /usr/lib64/sa/sadc -F -L -S DISK 1 1 -
  5  9116  0.0 CROND
  5  9117  0.0 /usr/lib64/sa/sadc -F -L -S DISK 1 1 -
  5  9286  0.0 CROND
  5  9287  0.0 /usr/lib64/sa/sadc -F -L -S DISK 1 1 -
  5   930  0.0 CROND
  5   931  0.0 /usr/lib64/sa/sadc -F -L -S DISK 1 1 -
  5    94  0.0 [md_misc/5]
  5  9489  0.0 CROND
  5  9490  0.0 /usr/lib64/sa/sadc -F -L -S DISK 1 1 -
  5  9659  0.0 CROND
  5  9660  0.0 /usr/lib64/sa/sadc -F -L -S DISK 1 1 -
  5  9829  0.0 CROND
  5  9830  0.0 /usr/lib64/sa/sadc -F -L -S DISK 1 1 -

首先需要安装一个包
# rpm -qa sysstat
sysstat-7.0.2-3.el5
这个包安装了一些很有用的文件
# rpm -ql sysstat
/usr/lib/sa/sadc
rpm -qa|grep sysstat
rpm -ql sysstat|grep sadc
/usr/lib64/sa/sadc

=====================================================
要启动SAR,必须通过cron工具以周期性的间隔启动。
安装sysstat包后,默认创建一个/etc/cron.d/sysstat文件,其默认内容为:
# run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib/sa/sa1 1 1
# generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib/sa/sa2 -A
这里用到了两个命令
/usr/lib/sa/sa1
/usr/lib/sa/sa2
sa1:是调用sadc(二进制文件),将数据收集到二进制日志文件的一个Shell脚本。sa1命令还确保每天使用不同的文件。每隔十分钟运行一次该命令,最好不要改这个值,这是对一般系统折中的值。二进制日志文件存放在/var/log/sa/目录下,命名为sa${DATE}。
sa2:是将当日二进制日志文件中所有的数据转储到文本文件(sar)的另一个Shell脚本,然后它将清除七天之前的所有日志文件。参数-A指定了从二进制文件中提取哪些数据转储到文本文件中。转储的文件存放在/var/log/sa/目录下,命名为sar${DATE}。
这两个命令要配合着使用。
(强烈建议看一下这两个命令的脚本)


查看一下/usr/lib/sa/sa1脚本,里面执行这样一句命令:
/usr/lib/sa/sadc -F -L 1 1 -
-F:强制指定一个储存文件,如果文件已存在,就将其转换成sa的二进制文件形式。
-L:给sa文件加互斥锁,不能让两个sadc进程同时写一个sa文件。


跟据sa1脚本中的命令,我们也可以手动的创建sa二进制文件,使用/usr/lib/sa/sadc命令,
# /usr/lib/sa/sadc 1 10 /tmp/jaylin_sa
上述命令的作用是:每隔1s写一条记录,写10条,存放到二进制文件/tmp/jaylin_sa中。


查看一下/usr/lib/sa/sa2脚本,里面执行这样一句命令:
/usr/bin/sar -A -f /var/log/sa/sa${DATE} > /var/log/sa/sar${DATE}
-A:列出所有存储在/var/log/sa/sa${DATE}里的统计信息。
-f:指定将要转储的sa文件,默认的参数值为/var/log/sa/sa${DATE}。

From:
http://linuxguest.blog.51cto.com/195664/541178/
[实践OK]FreeBSD中安装pkg:https://jackxiang.com/post/10436/
安装包安装方式:
pkg install -y lrzsz

Port安装方式:
cd /usr/ports/comms/lrzsz
make install clean
备注:这种方式为编译安装,安装时同样需要联网下载。

lrzsz的操作上传下载的文件列表:
/usr/local/bin/lrx
/usr/local/bin/lrz
/usr/local/bin/lsb
/usr/local/bin/lrb
/usr/local/bin/lsx
/usr/local/bin/lsz


第一步:软链接:
ln -sf /usr/local/bin/lrz /usr/local/bin/rz
ln -sf /usr/local/bin/lsz /usr/local/bin/sz


第二步:
vim ~/.bashrc
在文件末尾添加:
export PATH=$PATH:/usr/local/bin
source ~/.bashrc

Linux可以,Freebsd上不行:
cat << EOF >> ~/.bashrc
export PATH=$PATH:/usr/local/bin
EOF




Cause

This problem may be caused by improper handling of escape sequences embedded in the files being uploaded.

Resolution

Use the -e or --escape option on lrz, which escapes control characters (Z). For example, type, lrz -e. Some Zmodem clients expect escaping, while others do not.
Notes

Note, some installations of lrzsz do not have the "sz" or "rz" commands, only "lsz" and "lrz". You can edit your .login file and add lines like "alias sz lsz" and "alias rz lrz -e". This way, when you type "sz" or "rz", it will automatically execute the right program with the right options.

lrzsz is part of the FreeBSD ports collection. It contains a set of shell commands for sending and receiving files via the X/Y/ZMODEM protocols. Your SSH or Telnet client must support them for transfers to work.

阅读全文
背景:Git分不同角色在提交时,root提交时是administrator(Crontab用来Pull一些Ansible脚本到本地), 而xiangdong提交时是xiangdong,往往容易出现一个问题是不小心给root了,这块一是xiangdong上去有时权限不够可能切换为root了,另一个是登录时可能就是Root用户,一提交就成Admin了。鉴于此,自己整个C代码实现提交判断,这样接管了git push,从而对粗心的我来讲起到一个助理的作用。

一、搞这玩意儿的原因:
root情况:

xiangdong:

解决一个无论是root还是xiangdong的环境下,只需要执行下面我们搞的这个c语言生成的二进制文件就能一直只以向东的用户进行提交git,看起来扯淡,但还是有点用的,敲啥呢: gitpush ,和git push只是没有那个空格了。经实践证明是可行的,如下:


二、生产这个玩意的过程:
源码及Makefile和生成的二进制文件路径:


Makefile文件内容:
cat Makefile

源代码:cat gitpush.c



最后,PATH路径:
cat /etc/profile.d/gitpush.sh


三、验证步骤阶段:
root下执行情况:
#gitpush
#gitpush
当前登陆的用户名为:root
current working directory : /home/xiangdong/shell
The UID is 0
The login name is xiangdong
The forbidlogin name is root
请小心,你现在正在Root环境下面,不过没关系,我给你切换到xiangdong用户并作提交。执行git push命令:/usr/bin/sudo -i -u xiangdong -H cd /home/xiangdong/shell && git push
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 288 bytes, done.
Total 3 (delta 1), reused 1 (delta 0)
To git@gitlab.qr.justwinit.net:levooops/shell.git
   bd83c51..b400811  master -> master

xiangdong下面执行情况:
$gitpush
执行:cd /home/xiangdong/shell && git push
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 277 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@gitlab.qr.justwinit.net:levooops/shell.git
   b400811..0b19550  master -> master

成功Log:
$git log
commit 0b195507efa6278774d4f500a7086003d6744684
Author: xiangdong <xiangdong@justwinit.cn>
Date:   Sun Oct 1 23:15:32 2017 +0800

    加上README.md

commit b40081190bf020d49375a4117a181f00ea0a2503
Author: xiangdong <xiangdong@justwinit.cn>
Date:   Sun Oct 1 23:09:58 2017 +0800

    加上README.md

================================================================================
附录:
为什么 sudo cd 会报错 command not found:
https://www.starduster.me/2015/09/12/why-command-not-found-when-sudo-cd/

相关函数:get_current_dir_name, getwd, chdir
头文件:#include <unistd.h>
定义函数:char * getcwd(char * buf, size_t size);
函数说明:getcwd()会将当前的工作目录绝对路径复制到参数buf 所指的内存空间,参数size 为buf 的空间大小。
注:
1、在调用此函数时,buf 所指的内存空间要足够大。若工作目录绝对路径的字符串长度超过参数size 大小,则返回NULL,errno 的值则为ERANGE。
2、倘若参数buf 为NULL,getcwd()会依参数size 的大小自动配置内存(使用malloc()),如果参数size 也为0,则getcwd()会依工作目录绝对路径的字符串程度来决定所配置的内存大小,进程可以在使用完次字符串后利用free()来释放此空间。

返回值:执行成功则将结果复制到参数buf 所指的内存空间, 或是返回自动配置的字符串指针. 失败返回NULL,错误代码存于errno.

范例


执行:
current working directory :/tmp

cat test_processname.cpp



g++ test_processname.cpp -o gitpush
mv /tmp/gp /usr/local/gitpush/gitpush

cat /etc/profile.d/gp.sh
export PATH=$PATH:/usr/local/gitpush

#gp
directory:/usr/local/gitpush/
processname:gp
current working directory : /root


./gitpush
directory:/tmp/
processname:gitpush
current working directory : /tmp
The UID is 0
The login name is xiangdong
我的问题:git pull
error: Untracked working tree file 'playbook/ml.qr.justwinit.cn/process.yml' would be overwritten by merge.  Aborting
git fetch --all && git reset --hard origin/master
一、解决办法:


二、再git pull就没有问题了,当然,你的改动也被回退了,得先备份再做这个操作:
$git pull
Already up-to-date.

三、重新将文件放进去,再进行commit后push,没毛病:
git commit -m"xxx" ishow.justwinit.cn.conf.j2
git push
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 815 bytes, done.
Total 6 (delta 3), reused 0 (delta 0)
To git@gitlab.qr.cntv.net:irdcops/ansible.git
   d33031a..eb4ad86  master -> master
来自:https://www.codecaptain.io/reference/git/the-following-untracked-working-tree-files-would-be-overwritten-by-merge
     git中可以承载多个DAGs Repo一样的情况 git checkout --orphan命令。 git的常见用例是此功能是保持独立的文档和github的gh pages孤立的分支branch来创建一个静态网站。
孤立分支特征:
1)master好孤立分支是一个.git仓库里面的两颗独立的数,也就是说他俩没法合并。
2)master默认是保护的,建议把master 干掉,默认保护master的变为master.andorid,类似这样的。
3)孤立分支里面再建立分支,他们之间和常规分支一样的,没有区别。
一)其他用例孤立的分支有哪些?
可能的用法是用于将多个系统信息库组合成一个。 是一些例子:
Combining多个git库?
在这些情况下你必须在同一个档案库中的两个独立DAG之前合并到一个统一的目录树。 因此在长期使用,但这不是尽可能多的操作将暂时通过的状态使用单独的DAG所在的系统信息库中。

二)来自操作手册:
###创建孤立分支
    git version 1.7.2+

    # 创建
    git checkout --orphan <newbranch>
    
    # 删除无用文件
    git rm -rf .

    # 提交“空”内容
    git commit --allow-empty -m "[empty] initial commit"

    # 把新创建的本地分支,推送到远端仓库,保持跟踪
    git push -u origin <newbranch>


三)实践建一个“孤立”的空分支操作如下,命令来地址(https://ihower.tw/blog/archives/5691):


在Gitlab的Web界面里测试一下孤立分支:
newbranch   Merge RequestCompare Select Archive Format
754a735a · 测试一下刚建立的孤立分支  · 2 minutes ago

参考:https://ooso.net/archives/636
用处:strings命令主要用来做查看二进制的编译文件里面某个.c/.cpp文件编译到那个.so库中去了,或查看它调用了哪些库文件.
strings命令很简单, 看起来好像没什么, 但实际有很多用途。 下面, 我来举一个例子。  在大型的软件开发中, 假设有100个.c/.cpp文件, 这个.cpp文件最终生成10个.so库, 那么怎样才能快速知道某个.c/.cpp文件编译到那个.so库中去了呢? 当然, 你可能要说, 看makefile不就知道了。 对, 看makefile肯定可以, 但如下方法更好, 直接用命令:
      strings -f "*.so" | grep "xxxxxx"




/usr/local/node/bin/node


来自:http://blog.csdn.net/stpeace/article/details/46641069
二、Node编译高版本涉及Gcc相关的编译安装过程Url:
http://www.cnblogs.com/dee0912/p/5272149.html

关于编译Node的GCC版本升级:
1)linux下升级gcc的方法 – 亲测可用:https://www.cppfans.org/1719.html
2)编译安装 gcc 4.9并验证使用:http://blog.csdn.net/hzhxxx/article/details/28634893
问题:redis-3.0.7升级到redis-3.2.10,之前的数据文件/data/redis/6379/dump.rdb 没有删除,service redis start会报错,如下:


当前版本的redis无法处理version=7的RDB格式,这才明白是兼容性问题,但这种“向前兼容”一般很难做到的。
解决办法:删除rdb文件/var/lib/redis/6379/dump.rdb,重启redis就行了。

如果能解决掉Slave没有问题,那么, 线上坏了一台Slave的Redis可以直接替换掉即可:
在RPM打包发现:redis-3.0.7(线上)升级到redis-3.2.10的旧版本的dump.rdb格式无法启动如下:
但是经测试可以做Slave同步,现在CentOS6和CentOS7均升级至和epll仓库一样版本redis-3.2.10。
http://winmerge.org/
使用 CMAKE_INSTALL_PREFIX 来指定。
方法1:
[plain] view plain copy print?
cmake -DCMAKE_INSTALL_PREFIX=/usr ..  

方法二:
修改cmake文件,加入:
SET(CMAKE_INSTALL_PREFIX < install_path >)  

要加在 PROJECT(< project_name>) 之后。


摘录:
Default Build and Installation:

Installing vidstab library:

cd path/to/vid.stab/dir/
cmake .
make
sudo make install
默认会安装到:
1).h文件:
/usr/local/include/vid.stab
2).so文件:
/usr/local/lib/libvidstab.so


于是,想安装到指定目录,经rpmbuild打包修改成:

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/ffmpeg



来自:http://blog.csdn.net/caspiansea/article/details/53526725
零、少了20G的查看:
df -h
Filesystem                     Size    Used   Avail Capacity  Mounted on
/dev/ufsid/59a7effe7885633c     19G    5.6G     12G    31%    /
devfs                          1.0K    1.0K      0B   100%    /dev

一、gpart show 查看磁盘空间情况,可以看到磁盘大小是 40G,但是FreeBSD系统盘空间有20G,少了20G。
Welcome to Alibaba Cloud Elastic Compute Service !

root@iZ2ze0upl89i15wngnott5Z:~ # gpart show [img]=>      63  83886017  vtbd0  MBR  (40G)
        63         1         - free -  (512B)
        64  41942975      1  freebsd  [active]  (20G)
  41943039  41943041         - free -  (20G)

二、gpart recover ada0 恢复磁盘的空闲大小,然后再执行 gpart show 就可以看到磁盘的空闲空间了。
gpart recover vtbd0
vtbd0 recovering is not needed

三、gpart resize -i 3 -a 4k -s 40G vtbd0
用它:
gpart resize -i 1 -a 4k -s 39G vtbd0   #注意编号是1: -i 1
vtbd0s1 resized
上面FreeBSD14.1的精确计算大小和扩容再实践步骤参考:https://jackxiang.com/post/10934/

resize磁盘,我这里是50G的磁盘,但是不只能直接写50G,因为1G被swap占用了,512K被启动分区占用,最多只能使用48G,如果扩容到其他的大小,都需要在磁盘的总大小上减掉2G

growfs /dev/ada0p3

It's strongly recommended to make a backup before growing the file system.
OK to grow filesystem on /dev/vtbd0s1 from 20GB to 39GB? [yes/no] yes
growfs: /dev/vtbd0s1: Operation not permitted
扩容文件系统,执行完成以后会提示是否同意从 19G 扩容到 48G,以及一些风险提醒,直接Yes。


解决办法:freebsd resize partition
将growfs当做service来执行
service growfs onestart
实践OK如下:

4 、df -h看下能看到成功扩容。

aliyun do the resize the freebsd size:
attachment.php?fid=475[/img]

service growfs onestart
Growing root partition to fill device
vtbd0s1 resized
growfs: requested size 40GB is not larger than the current filesystem size 40GB

onestart 这个命令是什么意思?我找到了:
vim /etc/rc.d/growfs ,但是里面没有onestart。

在 /etc/rc.d/growfs 脚本中没有看到 onestart 的特定逻辑,但它是由 FreeBSD 的服务管理框架处理的。你可以使用 service growfs onestart 命令来一次性启动服务,而不会影响其自动启动状态。growfs_start() { 是入口。

https://help.aliyun.com/document_detail/35099.html


自己家里的服务器作了下kvm的扩容尝试,原因还是安装port时空间太小https://jackxiang.com/post/2849/,最后扩容成功就不存在这个问题了:
/usr/ports/x11/xprintidle/
mkdir: /usr/ports/x11: No space left on device
tar: could not chdir to '/usr/ports/x11/xprintidle/'
怎么办?扩容了:
qemu-img resize  FreeBSD-13.0-RELEASE-amd64.raw +128G  #运行成功后,去freeBSD里面进行扩容:
vim /etc/defaults/rc.conf   里面有sendmail部分的关闭参数说明,修改一下即可。
sendmail_enable="NO"    # Run the sendmail inbound daemon (YES/NO).

不想重新启动服务器的话(应急措施)∶killall sendmail  
/etc/rc.d/sendmail stop
Stopping sendmail.
Waiting for PIDS: 1489.
Cannot 'stop' sendmail_msp_queue. Set sendmail_msp_queue_enable to YES in /etc/rc.conf or use 'onestop' instead of 'stop'
/etc/rc.d/sendmail onestop
sendmail not running? (check /var/run/sendmail.pid).
sendmail_msp_queue not running? (check /var/spool/clientmqueue/sm-client.pid).

cat  /etc/rc.conf
hostname="jackxiang_owncloud_tools_diff_nginx_php_mysql_redis-10-10-0-237"
ifconfig_vtnet0="inet 10.10.0.*** netmask 255.255.255.0"
defaultrouter="*.*.0.1"
sshd_enable=yes
syslogd_flags="-s"
devd_flags="-s"
sendmail_submit_enable="NO"  
sendmail_outbound_enable="NO"  
sendmail_msp_queue_enable="NO"



因为Service php-fpm或mysql及nginx出现Freebsd重启不了,于是这样写就Ok了:
vi /etc/rc.conf


/etc/rc.d的启动需要在 /etc/rc.conf里打开,用Service就能启动,前面出问题不知道啥原因:
/etc/rc.d/php-fpm




你可能会因为种种原因而想在 FreeBSD 服务器上彻底禁用 sendmail,那么你可以尝试这样∶

1,如果你不想重新启动服务器的话(应急措施)∶

# killall sendmail
2,如果你想让 sendmail 在启动的时候就不做任何行为的话,你需要把以下这几行加入到 /etc/rc.conf 中∶

sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
加入之后需要重新启动服务器让设置生效。


来自:http://www.chinaz.com/server/2010/0226/107257.shtml


=============禁用freebsd ntpd 时间同步================
vi /etc/rc.conf
ntpd_enable="NO"

1.首先在rc.conf里面添加:ntpd_enable=”YES”。
2.修改/etc/ntp.conf
server 0.freebsd.pool.ntp.org iburst maxpoll 9
server 1.freebsd.pool.ntp.org iburst maxpoll 9
server 2.freebsd.pool.ntp.org iburst maxpoll 9
其他全部注释掉。
3.启动ntpd之前需要手动运行ntpdate pool.ntp.org先同步一下时间,避免因为系统时间与时间服务期时间相差太大导致渐次逼近无法实施而造成的ntpd运行失败。
4.运行/etc/rc.d/ntpd start启动服务。
5.可以通过ntpq -p命令来检查当前ntpd服务状态,注意看输出的表格中st这一项值,必须小于16,16代表无法连接时间服务器,如果都为16,则对时不能完成,需要检查网络原因。
6.ntpd服务需要开放对udp端口123的访问。

来自:http://www.voidcn.com/article/p-ebfmvhcn-ve.html

disable syslogd:
echo syslogd_enable=NO >> /etc/rc.conf

syslogd_enable="NO"  # vi /etc/rc.conf
来自:https://superuser.com/questions/626305/disabling-syslogd-in-freebsd

devd进程禁用开机启动:
devd_enable="NO" # vi /etc/rc.conf

iftop在Port下的安装:
cd /usr/ports/net-mgmt/iftop/ && make install clean

Freebsd下面加大SWAP实践OK:


/etc/fstab
md99       none         swap    sw,file=/swapfile,late  0   0

手工生效,否则用这个swapinfo -m就会发现只有1M:
mdconfig -a -t vnode -f  /swapfile -u 0 && swapon /dev/md0
swapinfo -m
Device          1M-blocks     Used    Avail Capacity
/dev/md0              512        0      512     0%
查看新增加的swap是否生效:top
CPU:  0.0% user,  0.0% nice,  0.0% system,  0.4% interrupt, 99.6% idle
Mem: 8616K Active, 11M Inact, 45M Wired, 4396K Buf, 1900M Free
Swap: 512M Total, 512M Free
From:http://darren2000.pixnet.net/blog/post/2180080-freebsd%E4%B8%8A%E6%96%B0%E5%A2%9Eswap%E7%A9%BA%E9%96%93
https://www.cyberciti.biz/faq/create-a-freebsd-swap-file/

Freebsd下实时查看各种信息:
systat 能实时查看各种信息
systat -pigs 默认值CPU
systat -iostat 硬盘IO
systat -swap 交换分区
systat -mbufs 网络缓冲区
systat -vmstat 虚拟内存
systat -netstat 网络
systat -icmp ICMP协议
systat -ip IP协议
systat -tcp TCP协议
systat -ifstat 网卡

显示PCI总线设备信息
pciconf -lv
显示内核加载的模块
kldstat -v
显示指定模块
klsdstat -m ipfilter

即插即用设备
pnpinfo

显示设备占用的IRQ和内存地址
devinfo -u

cpu
sysctl -a|grep cpu
sysctl -a|grep sched 查看使用的调度器,我编译的是ULE

虚拟内存
vmstat

硬盘
gstat
systat -iostat
iostat

网卡
ifconfig
systat -ifstat

网络
netstat
sockstat
tcpdump
trafshow
systat -mbufs
systat -icmp
systat -ip
systat -tcp

只是看流量的话,用systat -netstat
https://my.oschina.net/u/187928/blog/37049
背景:TCP高并发时用 netstat反应不过来,用ss,ss --help查不到下面的参数,得用 man ss查看。



Linux下的SS查看Linux的Http端口完成情况


Netid  Recv-Q Send-Q Local Address:Port                 Peer Address:Port                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32331                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32329                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32347                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32322                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32346                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32321                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32327                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32328                
tcp    0      0      101.200.228.135:http                 61.150.114.230:23159                
tcp    0      0      101.200.228.135:http                 1.85.216.135:50864                
tcp    0      0      101.200.228.135:http                 140.205.205.4:63844  



#ss dst  10.51.77.34
Netid State      Recv-Q Send-Q          Local Address:Port                           Peer Address:Port                
tcp   ESTAB      0      0                 10.51.77.34:6379                            10.51.77.34:53590                
tcp   ESTAB      0      0                 10.51.77.34:6379                            10.51.77.34:53586                
tcp   ESTAB      0      0                 10.51.77.34:53586                           10.51.77.34:6379                
tcp   CLOSE-WAIT 1      0                 10.51.77.34:43714                           10.51.77.34:6379                
tcp   ESTAB      0      0                 10.51.77.34:53590                           10.51.77.34:6379                
tcp   CLOSE-WAIT 1      0                 10.51.77.34:43718                           10.51.77.34:6379


加个源端口过滤一下(sport = 6379,等号之间得有空格):

Netid State      Recv-Q Send-Q          Local Address:Port                           Peer Address:Port                
tcp   ESTAB      0      0                 10.51.77.34:6379                            10.51.77.34:53590                
tcp   ESTAB      0      0                 10.51.77.34:6379                            10.51.77.34:53586


查看源地址Http端口的一个情况:

tcp   ESTAB      0      0             101.200.228.135:http                         101.81.172.212:41352                
tcp   ESTAB      0      0             101.200.228.135:http                           36.110.2.171:35007                
tcp   ESTAB      0      0             101.200.228.135:http                        115.236.174.162:55497                
tcp   ESTAB      0      0             101.200.228.135:http                           36.110.2.171:33458
分页: 25/339 第一页 上页 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 下页 最后页 [ 显示模式: 摘要 | 列表 ]