redis入门教程

window平台下的redis dll文件下载:https://github.com/char101/phpredis/downloads

Redis 根据 5 种不同的数据类型来操作数据对象:

String(字符串)
Sets(集合)
zsets( 排序后的sets集合)
List(列表)
hash(哈稀)

操作 String 类型的值:

Command Parameters Description
SET key value Set a key to a string value
GET key Return the string value of the key
GETSET key value Set a key to a string returning the old value of the key
MGET key1 key2 … keyN Multi-get, return the strings values of the keys
SETNX key value Set a key to a string value if the key does not exist
SETEX key time value Set+Expire combo command
MSET key1 value1 key2 value2 … keyN valueN Set multiple keys to multiple values in a single atomic operation
MSETNX key1 value1 key2 value2 … keyN valueN Set multiple keys to multiple values in a single atomic operation if none of the keys already exist
INCR key Increment the integer value of key
INCRBY key integer Increment the integer value of key by integer
DECR key Decrement the integer value of key
DECRBY key integer Decrement the integer value of key by integer
APPEND key value Append the specified string to the string stored at key
SUBSTR key start end Return a substring of a larger string

Continue reading

is not in the sudoers file. This incident will be reported的解决办法

在一般用户下执行sudo命令提示xxx is not in the sudoers file. This incident will be reported.解决方法:

$whereis sudoers
/etc/sudoers

有时候我们只需要执行一条root权限的命令也要su到root,是不是有些不方便?这时可以用sudo代替。默认新建的用户不在sudo组,需要编辑/etc/sudoers文件将用户加入,该文件只能使用visudo命令,

1) 首先需要切换到root, su – (注意有- ,这和su是不同的,在用命令”su”的时候只是切换到root,但没有把root的环境变量传过去,还是当前用乎的环境变量,用”su -“命令将环境变量也一起带过去,就象和root登录一样)

2) 然后 visudo 或者 vim /etc/sudoers, visudo 这个和vi的用法一样,由于可能会有人不太熟悉vi,所以简要说一下步骤

移动光标,到一行 root ALL=(ALL)   ALL 的下一行,添加一行

your_user_name ALL=(ALL)   ALL

然后保存退出! Continue reading

linux的vm相关参数介绍

1. 保证linux有足够的物理内存,可以调整vm的如下参数

vm.min_free_kbytes=409600;//默认值是3797,保证物理内存有足够空闲空间,防止突发性换页
vm.vfs_cache_pressure=200;//默认是100,增大这个参数设置了虚拟内存回收directory和i-node缓冲的倾向,这个值越大。越易回收
vm.swappiness=40 //缺省60,减少这个参数会使系统尽快通过swapout不使用的进程资源来释放更多的物理内存

一般在rac的配置环境中配置这三个参数,可以防止换页引起节点短暂无响应,导致节点重启
2. 改善io系统的性能
overcommit_memory = 0
vm.overcommit_ratio = 10 //默认值是50,用于虚拟内存的物理内存的百分比
vm.dirty_ratio = 20 //默认值是40,为了保持稳定,持续的写入,把这个值调整的小一些,经验值是20 Continue reading

git常用命令总结[原创]

txt笔记一篇:git常用命令点击查看
深入理解学习Git工作流(git-workflow-tutorial)http://segmentfault.com/a/1190000002918123
以下教程主要参考"Git-tutor(Git使用指南):http://blog.haohtml.com/archives/9066"实用指南而整理,第3章几乎直接在复制过来的.
相关教程:

第一章 Git的基本操作方法

一.初始化仓库

git init

此时会在当前目录*假如为($WORK)生成一个.git的目录文件.这个.git目录就是Git仓库.其中存放的是我们所提交的文档索引内容,Git 可基于文档索引内容对其所管理的文档进行内容追踪,从而实现文档的版本控制。工作树是包含 .git 的目录$WORK.如图所示

如何查看自己的电脑是否是64位?

2种方式:
一、开始>运行中输入“cmd”,然后在命令提示符窗口中输入“systeminfo”,如果您的系统是64位的,会在
“OS 名称: Microsoft Windows XP Professional” 一行后明确标示出“x64 Edition”,否则您的系统就是32位的。

这个命令比较实用的,值很收藏.

二、开始>运行中输入“winver”,如果您的系统是64位的,同样会明确标示出“x64 Edition”。

在 CentOS 装 Git

在 Ubuntu 上安装 Git 非常的简单,只需要:

sudo apt-get install git-core

但是 CentOS 默认的 yum 源中没有 Git,只能下载 RPM 包安装,确保已安装了依赖的包

sudo yum -y install curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel perl-ExtUtils-MakeMaker perl-CPAN tk

安装最新的 Git

$ wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
$ tar xzvf git-latest.tar.gz
$ cd git-{date}
$ autoconf
$ ./configure –with-curl=/usr/local
$ make
$ sudo make install

检查版本 Continue reading

node.js在linux下的安装教程

一.安装node.js

wet http://nodejs.org/dist/node-v0.4.8.tar.gz
tar zxvf node-v0.4.8.tar.gz
cd node-v0.4.8
./configure –prefix=/usr/local/node
make
make install

二.测试

创建test.js文件,内容如下:
var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Hello World\n’);
}).listen(1337, “127.0.0.1”);
console.log(‘Server running at http://127.0.0.1:1337/’);

执行: Continue reading

svn git 的windows客户端

根据自己使用的操作系统是32位的还是64位的不同,需要选择软件的相应版本。

先安装msysgit:
https://git-scm.com/downloads

再安装git windows客户端tortoisegit :

http://download.tortoisegit.org/

在安装tortoisegit的时候,选择第一个 Use(Tortoise)Plink即可。

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

TortoiseGit日常使用指南:/wp-content/uploads/2011/01/TortoiseGit_Guide.pdf

相关教程:

Git使用教程视频:http://blog.haohtml.com/archives/9066
Git使用学习教程:http://blog.haohtml.com/archives/10129
在 CentOS 装 Git:http://blog.haohtml.com/archives/10093
在FreeBSD下安装:http://blog.haohtml.com/archives/10065

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

svn windows客户端:
http://tortoisesvn.tigris.org/

在FreeBSD 8.1下搭建Git服务器

Git是一个由林纳斯•托瓦兹为了更好地管理linux内核开发而创立的分布式版本控制/软件配置管理软件。与常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版本库的方式,不必服务器端软件支持,使源代码的发布和交流极其方便。 Git 的速度很快,这对于诸如 Linux kernel 这样的大项目来说自然很重要。 Git 最为出色的是它的合并跟踪(merge tracing)能力。

1、在FreeBSD8.1下安装Git服务器

(1)用ports安装Git

cd /usr/ports/devel/git
make install clean

(2)修改/etc/rc.conf,让git随开机启动 Continue reading

mysql memcached UDF安装使用[教程]

在Centos5.6下通过验证!

官方网站:http://dev.mysql.com/doc/refman/5.1/en/ha-memcached-interfaces-mysqludf.html

很早之前,就看到了通过mysql UDF 更新memcached ,原来也研究过一段时间,只是没有来得及写个文档,导致后来工作中,经常要google,搜索其安装,使用的方法,刹时麻烦,今天总结一下:

1:mysql memcached UD介绍

mysql memcached UDF 其实就是通过libmemcached来使用memcache的一系列函数,通过这些函数,你能 对memcache进行get, set, cas, append, prepend, delete, increment, decrement objects操作,如果我们通过mysql trigger来使用这些函数,那么就能通过mysql更好的,更自动的管理memcache!下载地址:https://launchpad.net/memcached-udfs/+download

2:安装方法:

1)安装memcache和memcached

参考:http://blog.haohtml.com/archives/395

Continue reading