git stash和git stash pop的用法

一、基本操作
当你正在做一项复杂的工作时, 发现了一个和当前工作不相关但是又很讨厌的bug. 你这时想先修复bug再做手头的工作, 那么就可以用 git stash 来保存当前的工作状态, 等你修复完bug后,执行'反储藏'(unstash)操作就可以回到之前的工作里.
$ git stash save "work in progress for foo feature"
上面这条命令会保存你的本地修改到储藏(stash)中, 然后将你的工作目录和索引里的内容全部重置, 回到你当前所在分支的上次提交时的状态.
好了, 你现在就可以开始你的修复工作了.
... edit and test ...
$ git commit -a -m "blorpl: typofix"
当你修复完bug后, 你可以用git stash apply来回复到以前的工作状态.
$ git stash apply

Nginx利用多核cpu提高性能_配置参数worker_cpu_affinity

上篇文章http://blog.haohtml.com/archives/6213我们介绍了Nginx 的优化方法,这里主要对worker_cpu_affinity参数详细介绍一下.(官方:http://wiki.nginx.org/MainAndEventModules)
目录(?)

  1. 简介
  2. 规则设定
  3. 演示实例
    1. 两核cpu开启两个进程
    2. 两核cpu开启八个进程
    3. 核cpu开启8个进程
    4. 核cpu开启2个进程
  4. 重启ngin

简介

Nginx默认没有开启利用多核cpu,我们可以通过增加worker_cpu_affinity配置参数来充分利用多核cpu的性能。cpu是任务处理,计算最关键的资源,cpu核越多,性能就越好。

规则设定

(1)cpu有多少个核,就有几位数,1代表内核开启,0代表内核关闭
(2)worker_processes最多开启8个,8个以上性能就不会再提升了,而且稳定性会变的更低,因此8个进程够用了 Continue reading

Centos下安装Docker

内核要求至少 3.8.0版本或以上. https://docs.docker.com/linux/

第二步要安装epel库

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6-8.noarch.rpm

此时,会在/etc/yum.repo.d/目录里生成两个文件epel.repo  epel-testing.repo.

默认情况下epel.repo已经启用了enabled=1.

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

这里我用的centos7.0 x64的系统。

安装前需要安装相对应的epel库,我用的 Centos 7.0的系统。

$ wget http://ftp.sjtu.edu.cn/fedora/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

$ sudo rpm -Uvh epel-release-7-0.2.noarch.rpm

$ ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-Vault.repo epel.repo epel-testing.repo

Next, let's install the docker-io package which will install Docker on our host.

$ sudo yum install docker-io

Now that it's installed, let's start the Docker daemon.

$ sudo service docker start

[sudo] password for sysadmin:
Redirecting to /bin/systemctl start docker.service

If we want Docker to start at boot, we should also:

$ sudo chkconfig docker on

Note: Forwarding request to 'systemctl enable docker.service'.
ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.servic

Now let's verify that Docker is working. First we'll need to get the latest centos image.

$ sudo docker pull centos:latest

Next we'll make sure that we can see the image by running:

$ sudo docker images centos

This should generate some output similar to:

$ sudo docker images centos
REPOSITORY      TAG             IMAGE ID          CREATED             VIRTUAL SIZE
centos          latest          0b443ba039582 hours ago         297.6 MB

Run a simple bash shell to test the image:

$ sudo docker run -i -t centos /bin/bash

bash-4.2#

If everything is working properly, you'll get a simple bash prompt. Type exit to continue.

Done! You can either continue with the Docker User Guide or explore and build on the images yourself.

Issues?

If you have any issues - please report them directly in the CentOS bug tracker.

官方安装文档:http://docs.docker.com/installation/centos/

官方docker使用手册:http://docs.docker.com/userguide/ (中文手册:http://www.docker.org.cn/book/docker.html )