localhost

数据存储之非关系型数据库存储----MongoDB存储

匿名 (未验证) 提交于 2019-12-02 23:48:02
MongoDB存储----文档型数据库 利用pymongo连接MongoDB import pymongo client = pymongo.MongoClient(host='localhost', port=27017) # 或 pymongo.MongoClient('mongodb://localhost:23017/') # 默认端口为:27017 View Code # pymongo.MongoClient()方法 指定数据库 # 指定操作test数据库# db = client.test 或 db = client['test'] 指定集合 # 指定一个集合要操作的集合students# collection = db.students 或 collection = db['students'] 插入数据 import pymongo # 连接MongoDB client = pymongo.MongoClient(host='localhost', port=27017) # 指定数据库 db = client.test # 指定集合 collection = db.students # 数据 student = { 'id': '20180001', 'name': 'Jordan', 'age': 20, 'gender': 'male' } #

Tomcat的使用

匿名 (未验证) 提交于 2019-12-02 23:47:01
Tomcat是一款小巧灵活并使用较多的Web 应用服务器   1、使用tomcat需要先安装Java jdk并配置环境变量JAVA_HOME和JRE_HOME   2、下载tomcat,建议使用8.0以上版本。下载地址: http://tomcat.apache.org/ 。Windows下是apache-tomcat-9.0.22-windows-x64.zip   3、下载完成,解压安装包到某目录,例如解压到C盘根目录下的tomcat目录下.则安装完成    二、启动和关闭   在命令行模式下,进入tomcat/bin目录,执行startup.bat启动服务;执行 shutdown.bat关闭服务。 三、:       <?xml version='1.0' encoding='utf-8'?> <Server port="8005" shutdown="SHUTDOWN"> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" maxThreads=

Window从零开始搭建Jenkins+SonarQube持续集成平台

匿名 (未验证) 提交于 2019-12-02 23:47:01
此文档暂时不包含发布相关知识点。 持续集成环境:Jenkins 所需系统环境: java 8 及以上,配置 java 相关环境变量(此处略过) 代码托管:Git 2.22 或者 gitlab 审查工具:SonarQube 该工具由两部分组成,分别是 SonarQube本身(即是审查服务器),和 sonar-scanner(审查服务端) SonarQube和sonar-scanner的关系就像是 github 官网和我们本地的 git 软件的关系 snoar-scanner = sonar-runner 是同一个软件在不同版本下的名字,网上的教程两者基本上是通用的 Jenkins 提取密码:acko SonarQube v5.6 提取码:bpg1 sonar-scanner 提取码:cy1n mysql 5.7.19 提取码:pwwv 1.下载 Jenkins 的 war 包 2.在 war 包所在目录执行 java -jar jenkins.war --httpPort=8089 3.打开浏览器输入网址 localhost:8089 我们就能发现 Jenkins 已经跑起来了 1.首先需要安装 MySql 数据库(为了方便可配置mysql相关环境变量,同时第一次进入mysql需要修改密码,此处都略过,百度一下) root 登录 mysql,创建 sonar 数据库和用户授权。 2

关于socket模块获取ip失败报错

匿名 (未验证) 提交于 2019-12-02 23:47:01
问题:socket模块获取ip失败报错 In [64]: import socket In [71]: socket.gethostname() Out[71]: 'web01' In [72]: host_name = socket.gethostname() In [73]: socket.gethostbyname(host_name) --------------------------------------------------------------------------- gaierror Traceback (most recent call last) <ipython-input-73-52ba2e5a9213> in <module>() ----> 1 socket.gethostbyname(host_name) gaierror: [Errno -2] Name or service not known   解决办法: (venv1) [root@web01 bin]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6

net core 网关 初使用(1)

匿名 (未验证) 提交于 2019-12-02 23:43:01
新建 net core webapi 项目 安装 nuget 包 ``` Install-Package Ocelot ``` 配置 添加一个Ocelot.json的文件用来添加Ocelot的配置 转发 http://localhost:53743/jsmer => http://localhost:8088 { "GlobalConfiguration": { "BaseUrl": "http://localhost:53743" }, "ReRoutes": [ { "DownstreamPathTemplate": "/{postId}", "DownstreamScheme": "http", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 8088 } ], "UpstreamPathTemplate": "/jsmer/{postId}", "UpstreamHttpMethod": [ "Get" ] } ] } 说明 Downstream是下游服务配置 UpStream是上游服务配置 Aggregates 服务聚合配置 ServiceName, LoadBalancer, UseServiceDiscovery 配置服务发现 AuthenticationOptions 配置服务认证

Ocelot(十一)- 服务发现

匿名 (未验证) 提交于 2019-12-02 23:43:01
Ocelot允许您指定服务发现提供程序,并使用它来查找Ocelot正在将请求转发给下游服务的主机和端口。目前,这仅在GlobalConfiguration部分中受支持,这意味着所有ReRoute将使用相同的服务发现提供程序,以便在ReRoute级别指定ServiceName。 Consul GlobalConfiguration中需要以下内容。 提供者是必需的,如果你没有指定主机和端口,默认使用Consul。 "ServiceDiscoveryProvider": { "Host": "localhost", "Port": 9500 } 将来我们可以添加一个功能,允许ReRoute配置服务发现提供程序。 为了告诉Ocelot一个ReRoute需要使用服务发现提供程序来发现下游主机和端口,您必须在下游请求配置中添加ServiceName,UseServiceDiscovery和LoadBalancer。 目前Ocelot有RoundRobin(轮询)和LeastConnection(最少连接)两个负载均衡的算法。 如果没有指定负载均衡器,Ocelot将不会均衡请求。 { "DownstreamPathTemplate": "/api/posts/{postId}", "DownstreamScheme": "https", "UpstreamPathTemplate": "

PostgreSQL安装体验

匿名 (未验证) 提交于 2019-12-02 23:43:01
2019独角兽企业重金招聘Python工程师标准>>> 今天开始利用闲暇时间来学点PGSQL。下面我贴出我的初次安装体验。 1、遇到两个错误: 1)、configure: error: readline library not found 解决方法: 安装libtermcap-devel-2.0.8-46.1.i386.rpm 和readline-devel-5.1-1.1.i386.rpm 安装过程就不多说了。 checking for inflate in -lz... no 2)、configure: error: zlib library not found 解决方法: 安装zlib-devel-1.2.3-3.i386.rpm 然后./configurate;make;make install 如果到了这一步就表示安装成功了。 PostgreSQL installation complete. PGSQL 安装成功 2、后续设置 [root @localhost pgsql]# make dir /usr/local/pgsql/data POSTGRE好像不能用ROOT来操作。只能用普通用户。 [root @localhost pgsql]# adduser postgres [root @localhost pgsql]# chown -R postgres /usr

【知识点】Uri对象的完整地址

匿名 (未验证) 提交于 2019-12-02 23:43:01
通过HttpClient发送请求时,可以先设置BaseAddress,之后的请求直接传入相对地址即可: 1 using(var httpClient = new HttpClinet()) 2 { 3 httpClient.BaseAddress = new Uri("http://localhost:8082"); 4 await httpClient.GetAsync("Users"); // GET http://localhost:8082/Users 5 await httpClient.PutAsync("User/123", xx); // PUT http://localhost:8082/User/123 6 } 但是这里呢有个坑,就是传入的Uri是否以“/”结尾或开头,会使得最终请求的地址发生变化。 做个测试: 1 var baseUri = new Uri("http://localhost:8082/api"); 2 var relativeUri = new Uri("Users", UriKind.Relative); 3 var requestUri = new Uri(baseUri, relativeUri); 4 Console.WriteLine(requestUri); // http://localhost:8082/Users 5 6

Oracle修改监听IP地址

匿名 (未验证) 提交于 2019-12-02 23:43:01
2019独角兽企业重金招聘Python工程师标准>>> # Copyright (c) 1993 - 2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a ' # ' symbol. # # For example: # # 102.54

Oracle 监听器无法启动(TNS-12537,TNS-12560,TNS-00507)

匿名 (未验证) 提交于 2019-12-02 23:43:01
2019独角兽企业重金招聘Python工程师标准>>> Oracle启动监听报错,提示 连接中断 [oracle@localhost ~ ]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 06-AUG-2014 20:02:16 Copyright (c) 1991, 2009 , Oracle. All rights reserved. Starting /opt/oracle/11g/bin/ tnslsnr: please wait... TNS -12537 : TNS:connection closed TNS -12560 : TNS:protocol adapter error TNS -00507 : Connection closed Linux Error: 29: Illegal seek 这样一般是主机名不对,观察监听状态,监听主机名为 localhost: [oracle@localhost ~ ]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 06-AUG-2014 20:02:48 Copyright (c) 1991, 2009 , Oracle. All