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 ...
随机推荐
- Java IO(输入输出)
1. System.out.System.in System 内部: public final static InputStream in = null; public final static Pr ...
- 【Shell】变量的取用、删除、取代与替换
——来自<鸟哥的Linux私房菜> ——总结做方便查阅之用 变量的取用: echo echo $variableecho $PATHecho ${PATH} 变量的配置守则1.变量与变量内 ...
- BZOJ_2957_楼房重建_线段树
BZOJ_2957_楼房重建_线段树 Description 小A的楼房外有一大片施工工地,工地上有N栋待建的楼房.每天,这片工地上的房子拆了又建.建了又拆.他经常无聊地看着窗外发呆,数自己能够看到多 ...
- [转]BX9054: 各浏览器对 document.execCommand 方法的首参数可选值范围存在差异
作者:钱宝坤 标准参考 无. 问题描述 execCommand 方法通常用于控制可编辑的 IFRAME 内容,制作富文本编辑器. 但他现在为止还是非标准的,方法的首参数 Commmands 的可选值由 ...
- BZOJ1798:[AHOI2009]维护序列
浅谈树状数组与线段树:https://www.cnblogs.com/AKMer/p/9946944.html 题目传送门:https://www.lydsy.com/JudgeOnline/prob ...
- 我对sobel算子的理解
转自:http://blog.csdn.net/yanmy2012/article/details/8110316 索贝尔算子(Sobeloperator)主要用作边缘检测,在技术上,它是一离散性差分 ...
- 《Java多线程编程核心技术》读后感(十八)
线程中出现异常的处理 package Seven; public class MyThread extends Thread { @Override public void run() { Strin ...
- qpython 读入数据问题: EOF error with input / raw_input
直接使用input会报错 EOF error with input / raw_input 原因是在qpy里console mode 命令行模式不是完全和pc上的命令行一致,所以input和raw_i ...
- 3、opencv 图像显示功能
#include <iostream>#include <opencv2/opencv.hpp>using namespace cv;using namespace std;i ...
- mysql 快速导入大SQL文件
进入mysql mysql -u root -p 创建数据库 CREATE DATABASE 数据库名; 设置参数 set sql_log_bin=OFF;//关闭日志 ;//关闭autocommit ...