localhost

kafka集群搭建

痞子三分冷 提交于 2019-12-01 16:34:14
一、安装多节点ZooKeeper集群 下面就是在本机一台机器上安装3个节点的ZooKeeper集群,在多台机器上安装的方法和一台机器上是一样的,就是配置文件有微小的调整。 1.下载ZooKeeper包 https://www-us.apache.org/dist/zookeeper/stable/ 下载带bin的tar.gz文件,目前是apache-zookeeper-3.5.6-bin.tar.gz 解压 tar -zxvf apache-zookeeper-3.5.6-bin.tar.gz 把解压文件移动到/usr/local sudo mv apache-zookeeper-3.5.6-bin /usr/local/ 2.创建配置文件 在ZooKeeper的conf目录下创建3个配置文件zoo1.cfg,zoo2.cfg,zoo3.cfg,如果是在多台服务器上安装ZooKeeper集群可以取相同的配置文件名字。 zoo1.cfg tickTime=2000 dataDir=/home/xl/zookeeper/data_logs/zookeeper1 clientPort=2181 initLimit=5 syncLimint=2 server.1=localhost:2888:3888 server.2=localhost:2889:3889 serve.3

Web request fails, but only for localhost and when using System.Net.HttpWebRequest

两盒软妹~` 提交于 2019-12-01 16:33:30
I've got a very weird problem with System.Net.HttpWebRequest , that's driving me nuts: When I run it with a localhost address, then it is either extremely slow (around 30 sec) or, in most cases, it times out entirely. This happens only with requests that target localhost , and only from C# code. Concretely, taking an ASP.NET Web API project as an example, when I have this code: [Test] public void TestRequest() { var request = WebRequest.Create("http://localhost:64497/api/values"); WebResponse response = request.GetResponse(); } ..it will most of the time fail with this exception: System.Net

python操作redis之string

孤人 提交于 2019-12-01 16:01:06
# 通过init创建对象,指定参数host、port与指定的服务器和端口连接,# host默认为localhost、port默认为6379,db(数据库)默认为0sr=StrictRedis(host='localhost',port=6379,db=0)# 简写sr=StrictRedis() from redis import * #string-增加 try: #创建StrictRedis对象,与redis服务器建立连接 sr=StrictRedis(host='localhost',port=6379,db=1) #添加键name,值为憨憨 result=sr.set('name','憨憨') #输出响应结果,如果添加成功则返回True,否则返回False print(result) except Exception as e: print(e) #string-获取 try: sr=StrictRedis() #获取键name的值 result=sr.get('name') #输出键的值,如果键不存在则返回None print(result) except Exception as e: print(e) #string-修改 try: sr=StrictRedis() #设置键name的值,如果键已经存在则进行修改,如果键不存在则进行添加 result=sr.set(

Connect MySQL through localhost not working but 127.0.0.1 is working

淺唱寂寞╮ 提交于 2019-12-01 15:52:40
OS: Ubuntu 14.04 LTS php version control : phpbrew php version : 5.5.10 I pinged localhost which resolved to 127.0.0.1. This indicates that my host (/etc/hosts) file is correct. 127.0.0.1 localhost Whenever I try connecting to MySQL using a php script like the one below it doesn't work and gives me the error: no such directory. //connect to the database mysql_connect("localhost","root","password") or die(mysql_error()); However, when I connect via 127.0.0.1 it will work //connect to the database mysql_connect("127.0.0.1","root","password") or die(mysql_error()); Additionally, my phpmyadmin

How Do You Solve the Invalid Pointer Issue in Visual Studio 2013

老子叫甜甜 提交于 2019-12-01 15:30:56
问题 Ok, on the edge of frustration here... and I am having the worst time of my life. For the life of me, I cannot solve this issue with my Visual Studio 2013 installation. No matter what I've tried, it continues to throw up "Invalid Pointer" every time I attempt to preview my solution in a browser. Before I had other issues, but I uninstalled and re-installed. Updated, rebuild solution/project, set the browser to bypass the proxy for localhost, loaded the latest version of IIS and Asp.Net... you

Java使用Redis实例

浪子不回头ぞ 提交于 2019-12-01 15:28:20
在开始在 Java 中使用 Redis 前, 我们需要确保已经安装了 redis 服务及 Java redis 驱动,且你的机器上能正常使用 Java。 1)redis安装步骤参考 2)需要下载jedis.jar驱动包 redis安装包与jedis.jar提取链接:https://pan.baidu.com/s/1Y2jSlGMsuydbTqJZr_RJqg 提取码:k9pj 一:新建一个JAVAWEB项目 点击finish即可,web.xml不重要 再将jedis.jar架包放入WEB-INF下的lib中 二:实践案例 1. 连接本地的 Redis 服务和查看服务是否运行   1)首先打开redis服务    2)创建RedisJava类 public class RedisJava { public static void main(String[] args) { // 连接本地的 Redis 服务 Jedis jedis = new Jedis("localhost"); System.out.println("连接本地的 Redis 服务成功!"); // 查看服务是否运行 System.out.println("服务 正在运行: " + jedis.ping()); } }   运行结果:   需要用到redis时我们需要开启redis服务 2.Redis Java

MySQL主主同步

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 15:28:02
MySQL 主主同步方案 l MySQL 主主 +Keepalived l MySQL+DRBD+Heartbeat 在企业中,数据库高可用一直是企业的重中之重,中小企业很多都是使用 mysql 主 主 方案,一主多从,读写分离等,但是单主存在单点故障,从库切换成主库需要作改动。因此,如果是双主或者多主,就会增加 mysql 入口,增加高可用。 不过多主需要考虑自增长 ID 问题,这个需要特别设置配置文件,比如双主,可以使用奇偶 ,总之,主之间设置自增长 ID 相互不冲突就能完美解决自增长 ID 冲突问题。 主主方案实现思路 1、 两台 mysql 都可读写,互为主备 。 默认只使用一台 masterA 负责数据的写入,另一台 masterB 备用 处于备用状态 ; 2、 masterA 是 masterB 的主库, masterB 又是 masterA 的主库,它们互为主从; 3、 两台主库之间做高可用 , 可以采用 keepalived 等方案 , 使用 VIP 对外提供服务; 4、 所有提供服务的从服务器与 masterB 进行主从同步(双主多从) ; 5、 建议采用高可用策略的时候, masterA 或 masterB 均不因宕机恢复后而抢占 VIP (非抢占模式); 这样做可以在一定程度上保证主库的高可用 , 在一台主库 down 掉之后 ,

MMM实现Mysql高可用

a 夏天 提交于 2019-12-01 15:19:08
MySQL 主主同步方案 l MySQL 主主 +Keepalived l MySQL+DRBD+Heartbeat 在企业中,数据库高可用一直是企业的重中之重,中小企业很多都是使用 mysql 主主方案,一主多从,读写分离等,但是单主存在单点故障,从库切换成主库需要作改动。因此,如果是双主或者多主,就会增加 mysql 入口,增加高可用。 不过多主需要考虑自增长 ID 问题,这个需要特别设置配置文件,比如双主,可以使用奇偶 ,总之,主之间设置自增长 ID 相互不冲突就能完美解决自增长 ID 冲突问题。 主主方案实现思路 1、 两台 mysql 都可读写,互为主备。默认只使用一台 masterA 负责数据的写入,另一台 masterB 备用处于备用状态; 2、 masterA 是 masterB 的主库, masterB 又是 masterA 的主库,它们互为主从; 3、 两台主库之间做高可用 , 可以采用 keepalived 等方案,使用 VIP 对外提供服务; 4 、所有提供服务的从服务器与 masterB 进行主从同步(双主多从) ; 5 、建议采用高可用策略的时候, masterA 或 masterB 均不因宕机恢复后而抢占 VIP (非抢占模式); 这样做可以在一定程度上保证主库的高可用 , 在一台主库 down 掉之后 , 可以在极短的时间内切换到另一台主库上

Connect MySQL through localhost not working but 127.0.0.1 is working

我怕爱的太早我们不能终老 提交于 2019-12-01 14:54:16
问题 OS: Ubuntu 14.04 LTS php version control : phpbrew php version : 5.5.10 I pinged localhost which resolved to 127.0.0.1. This indicates that my host (/etc/hosts) file is correct. 127.0.0.1 localhost Whenever I try connecting to MySQL using a php script like the one below it doesn't work and gives me the error: no such directory. //connect to the database mysql_connect("localhost","root","password") or die(mysql_error()); However, when I connect via 127.0.0.1 it will work //connect to the

PHP cURL redirects to localhost

只谈情不闲聊 提交于 2019-12-01 14:40:55
I'm trying to login to an external webpage using a php script with cURL. I'm new to cURL, so I feel like I'm missing a lot of pieces. I found a few examples and modified them to allow access to https pages. Ultimately, my goal is to be able to login to the page and download a .csv by following a specified link once logged in. So far, what I have is a script that tests logging in to the page; the script is shown below: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.websiteurl.com/login'); curl_setopt($ch, CURLOPT_POSTFIELDS,'Email='.urlencode($login_email).'&Password='.urlencode(