Linux配置SVN和MemCached
SVN
Linux安装svn
yum -y install subversion(安装svn)
mkdir -p /svndata/projects/easyBuy
svnadmin create /svndata/projects/easyBuy(创建svn)
cd /svndata/projects/easyBuy/conf(修改配置文件)
vi authz(添加用户)
vi passwd(创建密码)
vi svnserve.conf(设置权限)
svnserve -d -r /svndata(启动svn;-d:后台执行,-r:版本库的根目录)
iptables -I INPUT -p tcp --dport 3690 -j ACCEPT
service iptables save(开启svn默认端口)
MyEclipse添加svn
将 site-1.10.13-1.9.x 中的如下文件复制到:
提交/上传项目
MemCached
Linux安装MemCached和Telnet
yum -y install memcached(安装Memcached)
memcached -u root -d -m 1024 -p 11211(启动Memcached)
iptables -I INPUT -p tcp --dport 11211 -j ACCEPT
service iptables save(开启Memcached端口)
rpm -q telnet-server
rpm -q telnet(查看是否已安装Telnet服务端和客户端)
yum -y install telnet-server
yum -y install telnet(安装Telnet)
vi /etc/xinetd.d/telnet (修改xinetd配置)
service xinetd restart(重启xinetd)
chkconfig --list telnet(查看telnet是否开启)
telnet 127.0.0.1 11211(使用telnet连接IP)
add <key> [time] <length>
<value>(添加)
get <key>(获取)
set <key> [time] <length>
<value>(修改或添加)
flush_all(清空)
Ctrl+]
quit(退出)
MyEclipse连接MemCached
import java.util.ArrayList; import java.util.List; import com.danga.MemCached.MemCachedClient; import com.danga.MemCached.SockIOPool; public class MemcachedUtils { static MemCachedClient client = null; static String[] connectUrls = new String[] { "127.0.0.1:11211" }; static { String[] attr = connectUrls; client = new MemCachedClient(); SockIOPool pool = SockIOPool.getInstance(); pool.setServers(attr); pool.setWeights(new Integer[] { 3 }); pool.setInitConn(5); pool.setMinConn(5); pool.setMaxConn(200); pool.setMaxIdle(1000 * 30 * 30); pool.setMaintSleep(30); pool.setNagle(false); pool.setSocketConnectTO(30); pool.initialize(); } public static void add(String key, Object object) { client.set(key, object); } public static void del(String key) { client.delete(key); } public static Object get(String key) { return client.get(key); } /** * 测试 */ public static void main(String args[]) { List<String> name = new ArrayList<String>(); name.add("1111"); name.add("2222"); name.add("3333"); name.add("4444"); name.add("5555"); add("name", name); List<String> test = (List<String>) get("name"); System.out.print(test); } }