memcache和iptables开启11211端口
linux下安装完memcached后,netstat -ant | grep LISTEN 看到memcache用的11211端口已在监听状态,但建立php文件连接测试发现没有输出结果,iptables开启相应端口即可。
测试memcache
<?php
$mem = new Memcache;
$mem->connect('192.168.1.110‘, 11211);
$mem->set('key', 'This is a memcache test!', 0, 60);
$val = $mem->get('key');
echo $val;
?>
iptables配置
#http://www.linuxfans.org/bbs/thread-133401-1-1.html 远程测试无效,本地可以?
#-A RH-Firewall-1-INPUT -p tcp -s 192.168.1.101 --dport 11211 -j ACCEPT
#-A RH-Firewall-1-INPUT -p tcp -s 192.168.1.110 --dport 11211 -j ACCEPT
#http://blog.sitepart.net/20 指定某个ip
-A RH-Firewall-1-INPUT -i 192.168.1.101 -p tcp --dport 11211 -j ACCEPT
#无ip限制
#-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT
常用iptables命令
(1)查看iptables规则
iptables -L -n
(2)清除表规则
iptables -F
iptables -X
iptables -Z
(3)设置默认规则
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
(4)修改后保存
/etc/rc.d/init.d/iptables save
service iptables stop
service iptables start
vi /etc/sysconfig/iptables
memcache和iptables开启11211端口的更多相关文章
- linux下如何修改iptables开启80端口
linux下如何修改iptables开启80端口 最近在做本地服务器的环境,发现网站localhost能正常访问,用ip访问就访问不了,经常使用CentOS的朋友,可能会遇到和我一样的问题.开启了 ...
- linux中用iptables开启指定端口
linux中用iptables开启指定端口 centos默认开启的端口只有22端口,专供于SSH服务,其他端口都需要自行开启. 1.修改/etc/sysconfig/iptables文件,增加如下 ...
- iptables 开启3306端口
[root@mysqld ~]# mysql -uroot -h 192.168.1.35 -p Enter password: ERROR 1130 (HY000): Host '192.168.1 ...
- CentOs7 使用iptables开启关闭端口
介绍 iptables命令是Linux上常用的防火墙软件,是netfilter项目的一部分 iptables文件设置路径:命令:vim /etc/sysconfig/iptables-config 注 ...
- 【linux】iptables 开启80端口
经常使用CentOS的朋友,可能会遇到和我一样的问题.开启了防火墙导致80端口无法访问,刚开始学习centos的朋友可以参考下. 经常使用CentOS的朋友,可能会遇到和我一样的问题.最近在Linux ...
- iptables 开启80端口
[root@v01-svn-test-server online]# iptables -F#清空规则 [root@v01-svn-test-server online]# iptables -L# ...
- linux mysql 授权以及 iptables开启3306
mysql授权ip段访问mysql grant all privileges on *.* to 'yang'@'192.168.1.%' identified by '123456'; linux ...
- iptables 开启端口
1.开启iptables端口 开启1521端口: iptables -A INPUT -p tcp --dport -j ACCEPT iptables -A OUTPUT -p tcp --dpo ...
- CentOs7 使用iptables防火墙开启关闭端口
CentOs7 使用iptables防火墙开启关闭端口 # 0x01介绍 iptables命令是Linux上常用的防火墙软件,是netfilter项目的一部分iptables文件设置路径:命令:v ...
随机推荐
- bzoj 3527: [Zjoi2014]力 快速傅里叶变换 FFT
题目大意: 给出n个数\(q_i\)定义 \[f_i = \sum_{i<j}{\frac{q_iq_j}{(i-j)^2}} - \sum_{i>j}\frac{q_iq_j}{(i-j ...
- 面试题: 数据库 oracle数据库 已看1 意义不大 有用
Oracle数据库面试题总结 2017年04月27日 22:41:44 阅读数:9271 1.SQL语句分类 DQL(数据查询语言)select DML(数据操作语言)insert.delete.up ...
- win10 ObservableCollection 排序自动收缩问题
ObservableCollection本身是没有排序Sort功能的,不过我们可以通过冒泡排序来实现,以下是扩展功能: public static void Sort<T>(this Ob ...
- 【hdu2955】 Robberies 01背包
标签:01背包 hdu2955 http://acm.hdu.edu.cn/showproblem.php?pid=2955 题意:盗贼抢银行,给出n个银行,每个银行有一定的资金和抢劫后被抓的概率,在 ...
- C++ 定位构造
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://yiluohuanghun.blog.51cto.com/3407300/1258 ...
- hdu 4336 Card Collector (概率dp+位运算 求期望)
题目链接 Card Collector Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- Linux 之 .bashrc 文件作用
Linux 系统中很多 shell,包括bash,sh,zsh,dash 和 korn 等,不管哪种 shell 都会有一个 .bashrc 的隐藏文件,它就相当于 shell 的配置文件. 一般会有 ...
- Go语言调度器之盗取goroutine(17)
本文是<Go语言调度器源代码情景分析>系列的第17篇,也是第三章<Goroutine调度策略>的第2小节. 上一小节我们分析了从全局运行队列与工作线程的本地运行队列获取goro ...
- DIV垂直水平居中
方法一:使用定位的方法 .parent { width: 300px; height: 200px; border: 1px solid red; position:relative; } .chil ...
- Git入门 时光穿梭鸡 版本回退 工作区 暂存区
分布式集中式 CVS及SVN都是集中式的版本控制系统 , 而Git是分布式版本控制系统 集中式版本控制系统,版本库是集中存放在中央服务器的, 而干活的时候,用的都是自己的电脑,所以要先从中央服务器取得 ...