现象:git checkout dev,出现,error: pathspec 'dev' did not match any file(s) known to git.
阅读全文
git version 2.7.4在提交时出现 push.default 警告问题。
两步解决:
步骤一:git config --global push.default simple
步骤二:git push -u origin master  #第一次,或:git push -u origin devel
步骤三:后再直接执行 git push 就可以了。


新建立分支后及时上面设置还是会报错怎么办?如下:
#git push
fatal: 当前分支 release1 没有对应的上游分支。
为推送当前分支并建立与远程上游的跟踪,使用

    git push --set-upstream origin release1

git config -l|grep simple
push.default=simple

按它提示的设置一下呢?就好了,如下:

git push --set-upstream origin release1
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for release1, visit:
.....
remote:
To git@gitlab.xxx.com.cn:devel/iot.lewo.com.git
* [new branch]      release1 -> release1
分支 release1 设置为跟踪来自 origin 的远程分支 release1。

在merge后,其并没有啥状态不一样的,因为没有冲突啥的,Merge后,以及提交后的一个对比:
Merge后:
#git status
位于分支 release1
无文件要提交,干净的工作区
提交Merge到GitServer后(git push --set-upstream origin release1):
#git status
位于分支 release1
您的分支与上游分支 'origin/release1' 一致。
无文件要提交,干净的工作区

=====================实践如下======================


git提交时,出现问题如下:
#git push origin/devel
warning: push.default 尚未设置,它的默认值在 Git 2.0 已从 'matching'
变更为 'simple'。若要不再显示本信息并保持传统习惯,进行如下设置:

  git config --global push.default matching

若要不再显示本信息并从现在开始采用新的使用习惯,设置:

  git config --global push.default simple

当 push.default 设置为 'matching' 后,git 将推送和远程同名的所有
本地分支。

从 Git 2.0 开始,Git 默认采用更为保守的 'simple' 模式,只推送当前
分支到远程关联的同名分支,即 'git push' 推送当前分支。

参见 'git help config' 并查找 'push.default' 以获取更多信息。
('simple' 模式由 Git 1.7.11 版本引入。如果您有时要使用老版本的 Git,
为保持兼容,请用 'current' 代替 'simple')

fatal: 'origin/devel' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
interactive_timeout :连接空闲超时时间。与服务器端无交互状态的连接,直到被服务器端强制关闭而等待的时间。
    interactive_timeout和wait_timeout意义虽然相同,但是有使用对象有本质的区别。interactive_timeout针对交互式连接(比如通过mysql客户端连接数据库),wait_timeout针对非交互式连接(比如一般在PHP中使用PDO连接数据库,当然你可以设置CLIENT_INTERACTIVE选项来改变)。所谓的交互式连接,即在mysql_real_connect()函数中使用了CLIENT_INTERACTIVE选项。
wait_timeout:连接空闲超时时间。与服务器端无交互状态的连接,直到被服务器端强制关闭而等待的时间。可以认为是服务器端连接空闲的时间,空闲超过这个时间将自动关闭。

交互连接:
interactive_timeout 需在mysql_connect()设置CLIENT_INTERACTIVE选项后起作用,并被赋值为wait_timeout;  #Mysql自己的客户端mysql命令。
mysql>set global wait_timeout = 60; 对当前交互链接有效; (由于mysql的BUG所有这边必须加global)
mysql>set global interactive_timeout = 60; 对后续起的交互链接有效;


解决MySQL server has gone away
应用程序(比如PHP)长时间的执行批量的MYSQL语句。最常见的就是采集或者新旧数据转化。
解决方案:
在my.cnf文件中添加或者修改以下两个变量:
wait_timeout=2880000
interactive_timeout = 2880000
关于两个变量的具体说明可以google或者看官方手册。如果不能修改my.cnf,则可以在连接数据库的时候设置CLIENT_INTERACTIVE,比如:
sql = "set interactive_timeout=24*3600";
mysql_real_query(...)

wait_timeout过大有弊端,其体现就是MySQL里大量的SLEEP进程无法及时释放,拖累系统性能,不过也不能把这个指设置的过小,否则你可能会遭遇到“MySQL has gone away”之类的问题,通常来说,我觉得把wait_timeout设置为10是个不错的选择,但某些情况下可能也会出问题,比如说有一个CRON脚本,其中两次SQL查询的间隔时间大于10秒的话,那么这个设置就有问题了(当然,这也不是不能解决的问题,你可以在程序里时不时mysql_ping一下,以便服务器知道你还活着,重新计算wait_timeout时间)

本质:
变量wait_timeout:服务器关闭非交互连接之前等待活动的秒数。也就是说你PHP获取一次数据后作计算了,并没有释放Mysql连接句柄,而你处理完后,继续获取数据,这个中间等待的秒数。  为了防止出现这个问题,用了mysql_ping:https://mo2g.com/view/128/
问题:这个秒数,DBA一般写10秒,能否突破和Mysql的Client一样,让它的值和interactive_timeout一样呢?

From:http://www.04007.cn/article/292.html
============================================================================================
总之,Mysql的原生客户端,在设置其wait_timeout的值时不受全局的设置限制,均等于全局(/etc/my.cnf)interactive_timeout的值,而PHP则并不改变全局的值,而是里面配置wait_timeout多少,此次连接就是多少,当然,也提供了类似Mysql自带客户端的参数。
阅读全文
背景:MHA里面有的LVS有兄弟用这样一句,也不会LVS,好像是用来检测Mysql的进程否还活着的Shell,vrrp_script chk_mysqld { script "killall -0 mysqld && exit 0 || exit 1"。这句是否完备,实践发现如果对于多进程模型,可能并不完备,如下实践。

后台服务需要不间断运行,意外退出后,需要将其重新拉起。常常可以通过向进程发送信号0,然后根据返回值来判断一个进程是否存在。比如进程名字为A,那么
exsit="killall -0 A;echo $?"
exsit为0就表示进程A存在,否则表示不存在。
然而,当有多个进程名字都是A的时候,只有在全部名字为A的进程都退出后,exsit才非0,所以这种监控方法并不太适合多进程环境(为了负载均衡,服务器常常采用多进程)。

我们来看例子。
testbin.c

make testbin
g++     testbin.cpp   -o testbin

然后我们运行他。
     1.启动父子总共5个进程。
./testbin
Start.....
summer 42187 start.......
summer 42186 start.......
summer 42185 start.......
summer 42184 start.......

2.发送killall -0
killall -0 testbin && echo 0 || echo 1          
0

发现有进程接收了信号

3..杀掉一个子进程
ps aux|grep testbin
root     45125  0.0  0.1  11880  1048 pts/0    S+   10:52   0:00 ./testbin
root     45126  0.0  0.0  11748   392 pts/0    S+   10:52   0:00 ./testbin
root     45127  0.0  0.0  11880   400 pts/0    S+   10:52   0:00 ./testbin
root     45128  0.0  0.0  11880   400 pts/0    S+   10:52   0:00 ./testbin
root     45129  0.0  0.0  11880   400 pts/0    S+   10:52   0:00 ./testbin

kill -s 9 PID
----------------
kill -s 9 45125
kill -s 9 45126

kill -s 9 45129
killall -0 testbin && echo 0 || echo 1
0

killall -0 testbin && echo 0 || echo 1
0

最后还剩下一个进程了:
ps aux|grep testbin                    
root     45128  0.0  0.0  11880   400 pts/0    S    10:52   0:00 ./testbin
killall -0 testbin && echo 0 || echo 1
0


注意此时这个子进程成了僵尸进程。虽然现在只有4个进程,但是killall -0发出的信号仍然被接收,所以返回0.再杀一个,只剩3个所以仍然又能进程接收相关信号,返回0.

4..killall杀掉所有的父子进程
kill -s 9 45128

此时没有进程接收信号,返回1.
killall -0 testbin && echo 0 || echo 1
testbin: no process killed
1


实践源来自:http://blog.csdn.net/wjj547670933/article/details/44535761
来自:https://www.zhihu.com/question/20019419
The -u tells Git to remember the parameters, so that next time we can simply run git push and Git will know what to do.相当于第一次串门的时候你登了个记办了个vip。。以后再来就知道是你来了。不用脱裤子搜身了

链接:https://www.zhihu.com/question/20019419/answer/80590142

http://m.blog.csdn.net/shen_gan/article/details/8167715
由于git的index文件出错。

需要删除.git/index文件,

然后运行git reset,重新生成index文件。
git reset还可以删除已经commit,但未push上去的信息。

From:https://my.oschina.net/dyxp/blog/380642
FreeBSD11.1好像不是这样的,清空/root/.bash_history没有用:在 /root/.history里,不是.bash_history。
  1000  1:10    mysql -S /tmp/mysql.sock
  1002  1:26    vi /root/.bash_history

history命令的記錄如何刪除?

1、修改/etc/profile將HISTSIZE=1000改成0或1

清除用戶home路徑下.bash_history

2、立即清空裏的history當前曆史命令的記錄

history -c

3、bash執行命令時不是馬上把命令名稱寫入history文件的,而是存放在內部的buffer中,等bash退出時會一並寫入。

不過,可以調用'history -w'命令要求bash立即更新history文件。

history -w
Linux/FreeBSD 终端/ssh登录前后的欢迎信息修改,均无问题,实践Ok,操作如下:
cat /etc/motd
Welcome to jackxiang's Compute Service !


From:http://xoyabc.blog.51cto.com/7401264/1679402
解决办法:
vi ~/.vimrc



FreeBSD下实践OK:


最后修改为:

SecureCRT显示:
root@jackxiang_owncloud_tools_diff_nginx_php_mysql_redis_47_94_8*_23*:/root

连接字串来自:https://git.codingallnight.com/chris/dotfiles/commit/46921501e65ab5c731b82280d0497680ff31418e
=================================================
'titleold' 選項。替換固定的字符串 "Thanks for flying Vim",用來在退出時設置標題。
let &titleold=getcwd()
From:http://vim.wikia.com/wiki/Show_a_useful_title_on_exit_in_an_xterm

My current ~/.vimrc contains (in part)
set title
set titleold=""
set titlestring=VIM:\ %F

From:https://github.com/lazywei/vim-doc-tw/blob/master/doc/version5.twx

More:http://vim.wikia.com/wiki/Show_a_useful_title_on_exit_in_an_xterm
cd /usr/ports/devel/strace/ && make install clean
A package is not available for ports marked as: Forbidden / Broken / Ignore / Restricted
PKGNAME: strace
ONLY_FOR_ARCHS: i386 #不支持AMD.
distinfo:
SHA256 (strace-4.5.18.tar.bz2) = 95e7b7470e04f22c3ec8dc6d0b1fdd8944306cb5313c84c4545cd83abada26d0
SIZE (strace-4.5.18.tar.bz2) = 480973

Install strace

First update FreeBSD ports collection and install strace from /usr/ports/devel/strace:
# portsnap fetch update
# cd /usr/ports/devel/strace
# make install clean

From:https://www.cyberciti.biz/faq/howto-installl-strace-under-freebsd/
人脸识别项目的开源测试程序及代码: https://github.com/Insightzen/autocrop ,要Python2.7以上,得选CentOS7,6的版本低,得编译,还需要python2-pip,得找一个源,epll默认没有,得找一个扩展源,如下:
CentOS7的默认Python版本:Python 2.7.5 ,而autocrop需要装:python2-pip ,
得找一个源,CentOS7下面用Fedora的源,放到,/etc/yum.repos.d,如下:
第一个问题,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
分页: 23/272 第一页 上页 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 下页 最后页 [ 显示模式: 摘要 | 列表 ]