localhost

Winows上简单配置使用kafka(.net使用)

拈花ヽ惹草 提交于 2019-12-02 02:21:47
一、kafka环境配置 1.jdk安装 安装文件:http://www.oracle.com/technetwork/java/javase/downloads/index.html 下载JDK 安装完成后需要添加以下的环境变量(右键点击“我的电脑” -> "高级系统设置" -> "环境变量" ): JAVA_HOME: C:\Program Files\Java\jdk-13.0.1(jdk的安装路径) Path: 现有值后追加 "%JAVA_HOME%\bin" 2.zookeeper安装 Kafka的运行依赖于Zookeeper,所以在运行Kafka之前我们需要安装并运行Zookeeper 下载安装文件: http://zookeeper.apache.org/releases.html 解压文件 apache-zookeeper-3.5.6-bin.tar 打开zookeeper-3.5.6\conf,把zoo_sample.cfg重命名成zoo.cfg 从文本编辑器里打开zoo.cfg, 把dataDir的值改成“./apache-zookeeper-3.5.6/data” 添加如下系统变量: ZOOKEEPER_HOME: C:\Users\Yc\work\apache-zookeeper-3.5.6 (zookeeper目录) Path: 在现有的值后面添加 ";

Cannot connect to localhost API from Android app

醉酒当歌 提交于 2019-12-02 02:15:19
问题 I am new to Django. I have created an API named http://127.0.0.1:8000/api/update/1/ and it works perfectly in the browser and on the Postman app. However, when I am trying to access the API from the Android app it is returning NULL. The android code works when the API is the following. http://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=8190df9eb51445228e397e4185311a66 However, it does not work when the API is the following, even if the following API works just fine from my

.Netcore 2.0 Ocelot Api网关教程(7)- 限流

血红的双手。 提交于 2019-12-02 02:01:53
本文介绍Ocelot中的限流,限流允许Api网关控制一段时间内特定api的总访问次数。 限流的使用非常简单,只需要添加配置即可。 1、添加限流 修改 configuration.json 配置文件,对 UpstreamPathTemplate 为 /webapib/values 的配置修改如下: { // ... "UpstreamPathTemplate": "/webapib/values", "UpstreamHttpMethod": [ "Get" ], "RateLimitOptions": { "ClientWhiteList": [ "myclient" ], "EnableRateLimiting": true, "Period": "1m", "PeriodTimespan": 30, "Limit": 2 } } 对 RateLimitOptions 中几个配置项做下解释: ClientWhiteList:一个字符串数组,在请求头中包含ClientId=xxx的请求不受限流控制,其中ClientId这个key可以修改,后边会介绍,xxx表示配置的白名单。 EnableRateLimiting:Boolean值,是否启用限流,只有为true时,配置生效。 Period:限流控制的时间段,可以输入 1s(1秒),1m(1分),1h(1小时),1d(1天)类似的值

.Netcore 2.0 Ocelot Api网关教程(8)- 缓存

ⅰ亾dé卋堺 提交于 2019-12-02 02:01:26
Ocelot中使用 CacheManager 来支持缓存,官方文档中强烈建议使用该包作为缓存工具。 以下介绍通过使用CacheManager来实现Ocelot缓存。 1、通过Nuget添加 Ocelot.Cache.CacheManager 包 在OcelotGetway项目中添加引用: Add cache package.png 2、修改 Startup 中的 ConfigureServices 方法 修改如下: services .AddOcelot(new ConfigurationBuilder() .AddJsonFile("configuration.json") .Build()) .AddConsul() .AddCacheManager(x => x.WithDictionaryHandle()) .AddAdministration("/administration", "secret"); 3、修改 WebApiA 添加一个 TimeController 并添加如下代码: using System; using Microsoft.AspNetCore.Mvc; namespace WebApiA.Controllers { [Produces("application/json")] [Route("api/[controller]/[action]")]

.Netcore 2.0 Ocelot Api网关教程(4)- 服务发现

筅森魡賤 提交于 2019-12-02 01:59:52
本文介绍Ocelot中的服务发现(Service Discovery),Ocelot允许指定一个服务发现提供器,之后将从中寻找下游服务的host和port来进行请求路由。 关于服务发现的详细介绍请 点击 。 在Ocelot中使用了 Consul 作为服务发现的provider。 1、Consul下载安装 从 官方下载页 选择合适的平台下载,解压出一个二进制文件并保存到相应位置,并将路径存入path中,本文以windows版本为例(其他平台操作类似)。 打开 cmd/powershell 运行 consul agent -dev 输出如下文本表示成功以dev方式启动consul ==> Starting Consul agent... ==> Consul agent running! Version: 'v1.0.7' Node ID: '3fc1edca-b635-56cc-b767-01a942423f73' Node name: 'Weidaicheng-PC' Datacenter: 'dc1' (Segment: '<all>') Server: true (Bootstrap: false) Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, DNS: 8600) Cluster Addr: 127.0.0.1 (LAN:

.Netcore 2.0 Ocelot Api网关教程(1)- 入门

我与影子孤独终老i 提交于 2019-12-02 01:58:54
Ocelot(Github) Ocelot官方文档(英文) 本文不会介绍Api网关是什么以及Ocelot能干什么 需要对Api网关及Ocelot有一定的理论了解 开始使用Ocelot搭建一个入门级Api网关 1.新建3个WebApi项目,分别命名为OcelotGetway、WebApiA、WebApiB webapi项目.png OcelotGetway项目用于做Api网关 WebApiA、WebApiB作为两个api接口服务 2.在OcelotGetway项目的Nuget包管理器中搜索Ocelot并安装 Nuget包管理器.png 或者在程序包管理器中输入 Install-Package Ocelot 安装 3.在OcelotGetway项目中新建json文件并命名为configuration.json在VS中右键修改为“始终复制” configuration.json.png 4.编辑configuration.json文件并添加以下内容 { "ReRoutes": [ { "DownstreamPathTemplate": "/api/values", "DownstreamScheme": "http", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 5001 } ],

NGINX学习(五)--nginx做负载均衡

南楼画角 提交于 2019-12-02 01:57:58
负载均衡也是 Nginx 常用的一个功能,负载均衡其意思就是分摊到多个操作单元上进行执行,例如:Web服务器、FTP服务器、企业关键应用服务器和其它关键任务服务器等,从而共同完成工作任务。简单而言就是当有2台或以上服务器时,根据规则随机的将请求分发到指定的服务器上处理,负载均衡配置一般都需要同时配置反向代理,通过反向代理跳转到负载均衡。而Nginx目前支持自带3种负载均衡策略,还有2种常用的第三方策略。 1、RR(默认) 每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。 简单配置 upstream test { server localhost:8080; server localhost:8081; } server { listen 81; server_name localhost; client_max_body_size 1024M; location / { proxy_pass http://test; proxy_set_header Host $host:$server_port; } } 配置了2台服务器,当然实际上是一台,只是端口不一样而已,而8081的服务器是不存在的,也就是说访问不到,但是我们访问 http://localhost 的时候,也不会有问题,会默认跳转到 http://localhost:8080

php curl localhost is slow when making concurrent requests

佐手、 提交于 2019-12-02 01:45:53
I have an interesting issue which I am not sure what the root cause is. I have a server and two virtual hosts A and B with ports running on 80 and 81 respectively. I have written a simple PHP code on A which looks like this: <?php echo "from A server\n"; And another simple PHP code on B: <?php echo "B server:\n"; // create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, "localhost:81/a.php"); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // $output contains the output string $output = curl_exec($ch); // close curl resource to free up

mysql 常用方法

走远了吗. 提交于 2019-12-02 00:55:52
                    1、连接Mysql 格式:mysql -h 主机地址 -u用户名 -p用户密码 1、连接到本机上的MYSQL。 首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root -p,回车后提示你输密码,注意用户名前可以有空格也可以没有空格,但是密码前必须没有空格,否则让你重新输入密码。 如果刚安装好MYSQL,超级用户root是没有密码的,故直接即可进入到mysql中了,mysql的提示符是:mysql> 2、连接到远程主机上的mysql。假设远程主机的IP为:110.110.110.110,用户名为root,密码为adcd123。则键入以下命令:   mysql -h100.100.100.100 -u root -p 123;(注:u与root之间可以不用加空格,其它也一样) 3、退出mysql命令:exit(回车)                     2、修改密码 格式:mysqladmin -u用户名 -p旧密码 password 新密码 1、给root加个密码12ad。 首先在DOS下进入目录mysql/bin,然后以下命令   mysqladmin -u root -password ad12 注:因为开始时root没有密码,所以-p旧密码一项可以省略了。 2、再将root的密码改为djg345.

PHP Cookies works well on localhost, but it's not working on live server

点点圈 提交于 2019-12-02 00:47:14
Note: This issue is already solved, finally I found that it's not cookies problem, the problem is on unserialize() function. The serialized cookie which being the parameter of that function must be stripslash-ed first. Hi there, I have a problem here about PHP Cookies. I'm using PHP Cookies to save user preferences. I've tested my code on my local machine (localhost using XAMPP). Everything's works very well, including the cookies. But when I uploaded it to the live server, the cookies not working at all. It seems that the setcookie() function do not write the cookie value. I've tested by echo