应用场景,多人合作开发项目的时候,我们要给别人的文件添加内容时候,首先要拉取别人的分支,下面是具体步骤

 

Administrator@AFOIH-1122 MINGW64 /d/api (master)

$ git remote -v
origin  git@github.com:test/apis.git (fetch)
origin  git@github.com:test/apis.git (push)

Administrator@AFOIH-1122 MINGW64 /d/api (master)
$ git remote add upstream https://github.com/other/apis.git

Administrator@AFOIH-1122 MINGW64 /d/api (master)
$ git remote -v
origin  git@github.com:test/apis.git (fetch)
origin  git@github.com:test/apis.git (push)
upstream        https://github.com/other/apis.git (fetch)
upstream        https://github.com/other/apis.git (push)

Administrator@AFOIH-1122 MINGW64 /d/api (master)
$ git fetch upstream
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), done.
From https://github.com/other/apis
 * [new branch]      master     -> upstream/master

Administrator@AFOIH-1122 MINGW64 /d/api (master)
$ git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.

Administrator@AFOIH-1122 MINGW64 /d/api (master)
$ git merge upstream/master
Updating 177e46d..4c9fd1a
Fast-forward

Read More →

软件版本
memcached-1.4.5
memcache-3.0.5
php-5.2.11

1.查memcache状态
/usr/bin/perl /usr/local/src/memcached-1.4.5/scripts/memcached-tool localhost:11211
或者
telnet localhost 11211

2.手动清除memcached测试

1). flush_all
echo “flush_all” | nc localhost 11211

# telnet localhost 11211
Trying 127.0.0.1…
Connected to localhost.localdomain (127.0.0.1).
Escape character is ‘^]’.
get var_key
VALUE var_key 0 13
test variable
END
flush_all
OK
get var_key
END
quit
Connection closed by foreign host.

2). 重启memcached进程
kill $(ps aux|grep memcached|grep -v grep |awk ‘{print $2}’)
/usr/local/memcached/bin/memcached -d -m 256 -p 11211 -u nobody

3)Memcache::flush() immediately invalidates all existing items.
/* procedural API */
$memcache_obj = memcache_connect(‘memcache_host’, 11211);
memcache_flush($memcache_obj);
/* OO API */
$memcache_obj = new Memcache;
$memcache_obj->connect(‘memcache_host’, 11211);
$memcache_obj->flush();
?>
这个测试的表现是请求Memcache::flush()以后仍可以get $key取到值,而且通过memcached-tool 查到该item的max_age并无变化.

为了备份虚拟主机的MySQL数据库,只能用mysqldump导出到本地。

运行:

mysqldump –opt -h192. 168.0 . 156 -uUsername -pPassword databaseName>database.sql

mysqldump –opt -h192.168.0.156 -uUsername -pPassword databaseName>database.sql

但由于数据库用户的权限不够,总显示:
mysqldump: Got error: 1044 : Access denied for user ‘Username’ @ ‘%’ to database ‘databaseName’ when using LOCK TABLES

mysqldump: Got error: 1044: Access denied for user ‘Username’@’%’ to database ‘databaseName’ when using LOCK TABLES
是没有LOCK TABLES的权限,于是查看mysqldump的帮助,加上参数–skip-lock-tables
mysqldump –opt -h192. 168.0 . 156 -uUsername -pPassword –skip-lock-tables databaseName>database.sql

远程导出:

mysqldump -P [端口] -h [IP] -u [用户] -p test>d:/test.sql

例如:

mysqldump -P 3306 -h 192.168.1.224 -u root -p test>d:/test.sql
远程导入:

mysql -h[IP] -P[端口] -u[用户] -p test<c:/test.sql

例如:

mysql -h 192.168.1.224 -P 3306 -u root -p test<c:/test.sql

问题:
CentOS7安装完毕,重新开机启动后显示:
Initial setup of CentOS Linux 7 (core)
1) [x] Creat user 2) [!] License information
(no user will be created) (license not accepted)
Please make your choice from above [‘q’ to quit | ‘c’ to continue | ‘r’ to refresh]:
解决方法:
输入“1”,按Enter键
输入“2”,按Enter键
输入“q”,按Enter键
输入“yes”,按Enter键

Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令:

lsof -i tcp:80

列出所有端口

netstat -ntlp

1、开启端口(以80端口为例)

方法一:

/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT 写入修改

/etc/init.d/iptables save 保存修改

service iptables restart 重启防火墙,修改生效

方法二:

vi /etc/sysconfig/iptables 打开配置文件加入如下语句:

-A INPUT -p tcp -m state –state NEW -m tcp –dport 80 -j ACCEPT 重启防火墙,修改完成

2、关闭端口

方法一:

/sbin/iptables -I INPUT -p tcp –dport 80 -j DROP 写入修改

/etc/init.d/iptables save 保存修改

service iptables restart 重启防火墙,修改生效

方法二:

vi /etc/sysconfig/iptables 打开配置文件加入如下语句:

-A INPUT -p tcp -m state –state NEW -m tcp –dport 80 -j DROP 重启防火墙,修改完成

3、查看端口状态

/etc/init.d/iptables status