test

K8S 之 Flannel之SNAT规划优化

时光怂恿深爱的人放手 提交于 2020-02-05 00:04:25
一、Flannel之SNAT规划优化作用 解决两宿主机容器之间的透明访问,如不进行优化,容器之间的访问,日志记录为宿主机的IP地址。 1、宿主机访问172.7.22.2的nginx容器情况 2、172.7.22.2查看nginx访问日志 3、进入172.7.21.2的容器访问172.7.22.2的nginx容器,查看日志 4、再次查看172.7.22.2的nginx访问日志 5、解决问题:当容器172.7.21.2访问172.7.22.2的nginx容器时,展示的日志应为172.7.21.2 二、解决方法 1、安装iptables-services组件 [root@test-nodes1 ~]# yum -y install iptables-services [root@test-nodes1 ~]# systemctl start iptables [root@test-nodes1 ~]# systemctl enable iptables Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service. ------------------------------------------------

Lambda表达式

点点圈 提交于 2020-02-04 23:23:46
学习Lambda表达式之前需要一些铺垫,下面直接开始把 1. 接口的默认方法 接口之前定义为只有常量和抽象方法,JDK1.8之后增加了默认方法 public interface Test { int num = 10; abstract void say(); default void sayHello(){ System.out.println("sayHello"); } } public static void main(String[] args) { Test test = new Test(){ @Override public void say() { System.out.println("say"); } }; test.say(); test.sayHello(); } say sayHello 2. 函数式接口 函数式接口(Functional Interface)就是一个有且仅有一个抽象方法,但是可以有多个非抽象方法的接口,下面举例多线程的Runnable接口 @FunctionalInterface public interface Runnable { public abstract void run(); } 从中可以看出该接口只有一个抽象方法,并且方法上标有@FunctionalInterface注解,不了解注解的同学可以康康 注解传送门 3.

Python学习,第八课 - 函数

一个人想着一个人 提交于 2020-02-04 21:55:42
本次讲解函数,由于内容比较多,小编列了个大纲,主要有一下内容: 1. 函数基本语法及特性 2. 函数参数 3.局部变量 4. 返回值 5.嵌套函数 6.递归 7.匿名函数 8.高阶函数 9.内置函数 1. 函数基本语法及特性 函数的定义:函数是指将一组语句的集合通过一个名字(函数名)封装起来,要想执行这个函数,只需调用其函数名即可 函数的特性: 减少重复代码 使程序变的可扩展 使程序变的易维护 函数的语法定义 直接上代码: # def 是定义函数的关键字 def test():#test既是函数名 print('学习Python的第一个函数') test() #调用函数 同时函数也可以带参数 a, b = 1, 3 # 带参函数 def test(x, y): # x 和 y 即是在我们调用函数时传入的参数 return x + y # 返回执行的结果 c = test(a, b) # 把函数返回结果赋值给 C print(c) 2. 函数参数 在说函数参数前,大家需要了解一个知识点, 形参 & 实参 何为形参? 既变量只有在被调用时才分配内存单元,在调用结束时,即刻释放所分配的内存单元。 因此,形参只在函数内部有效,函数调用结束返回主调用函数后则不能再使用该形参变量 何为实参? 既可以是常量、变量、表达式、函数等,无论实参是何种类型的量,在进行函数调用时,它们都必须有确定的值

K8S 之 Flannel网络插件安装

邮差的信 提交于 2020-02-04 20:46:12
一、flannel的作用 1、CNI网络插件最主要的功能就是实现POD资源能够跨宿主机是进行能信 #test-nodes1主机无法ping通test-nodes2主机的pod容器 [root@test-nodes1 ~]# kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-ds1-qg45q 1/1 Running 0 2d12h 172.7.22.3 test-nodes2.cedarhd.com <none> <none> nginx-ds1-whnmv 1/1 Running 0 2d12h 172.7.21.3 test-nodes1.cedarhd.com <none> <none> [root@test-nodes1 ~]# ping 172.7.22.3 PING 172.7.22.3 (172.7.22.3) 56(84) bytes of data. ^C --- 172.7.22.3 ping statistics --- 8 packets transmitted, 0 received, 100% packet loss, time 6999ms 二、flannel安装 #此操作分别需要在test

Docker仓库

雨燕双飞 提交于 2020-02-04 20:06:04
简介   仓库(Repository)是集中存放镜像的地方。   一个容易与之混淆的概念是注册服务器(Registry)。实际上注册服务器是存放仓库的具体服务器,每个服务器上可以有多个仓库,而每个仓库下面有多个镜像。从这方面来说,仓库可以被认为是一个具体的项目或目录。例如对于仓库地址hub.docker.com/_/ubuntu来说,hub.docker.com是注册服务器地址,ubuntu是仓库名。   仓库又分公共仓库和私有仓库,在本文将展示如何使用DockerHub官方仓库进行登录、下载等基本操作;最后还将介绍创建和使用私有仓库的基本操作。 Docker Hub   目前Docker官方维护了一个公共仓库https:/hub.docker.com,其中已经包括15000多个的镜像。大部分需求都可以通过在Docker Hub中直接下载镜像来实现。 登录   可以通过执行docker login命令来输入用户名、密码和邮箱来完成注册和登录。注册成功后,本地用户目录的.dockercfg中将保存用户的认证信息。 基本操作   用户无需登录即可通过docker search命令来查找官方仓库中的镜像,并利用docker pull命令来将它下载到本地。   在前面博文中,已经具体介绍了如何使用docker pull命令。例如以centos为关键词进行搜索: [root@gavin ~]

Spring中的IoC(4)

混江龙づ霸主 提交于 2020-02-04 18:21:16
Spring中的IoC(4) 基于xml的IoC案例 public interface AccountDAO { /** * 查询所有 * @return */ List < Account > findAllAccount ( ) ; /** * 通过id查询所有 * * @param id * @return */ Account findAccountById ( int id ) ; /** * 保存数据 * @param account */ void saveAccount ( Account account ) ; /** * 修改 * @param account */ void updateAccount ( Account account ) ; /** * 通过id删除 * @param id */ void deleteById ( int id ) ; } public class AccountDAOImpl implements AccountDAO { private QueryRunner runner ; public void setRunner ( QueryRunner runner ) { this . runner = runner ; } @Override public List < Account > findAllAccount

机器学习------NLP

旧城冷巷雨未停 提交于 2020-02-04 18:02:32
文章目录 文本相似度分析 情感分类 NLP: Natural Language Processing 自然语言处理 文本相似度分析 指从海量数据(文章,评论)中,把相似的数据挑选出来 步骤如下 : 1: 把评论翻译成机器看的懂的语言 中文分词 :把句子拆分成词语 工具:结巴分词 (Terminal中 pip install jieba -i https://pypi.douban.com/simple/ ) 结巴中文分析支持的三种分词模式包括: (1)精确模式:试图将句子最精确的切开,适合文本分析(默认模式) (2)全模式:把句子中所有的可以成词的词语都扫描出来,速度非常快,但是不能解决歧义问题 (3)搜索引擎模式:在精确模式的基础上,对长词再次切分,提高召回率,适合用于搜素引擎分词 text = "我来到北京清华大学" seg_list = jieba.cut(text, cut_all=True) print("全模式:", "/ ".join(seg_list)) 执行结果: 全模式: 我/ 来到/ 北京/ 清华/ 清华大学/ 华大/ 大学 自制字典进行关键字提取 ,字典范围小效果不好。 import jieba import jieba.analyse jieba.load_userdict('./mydict.txt') text = "故宫的著名景点包括乾清宫

mybatis动态SQL与批量插入

别来无恙 提交于 2020-02-04 16:16:14
一 前言 本篇文章需要有一定得mybatis入门基础才能学习;如果是初学者请参考以下链接进行系统学习 mybatis入门 https://blog.csdn.net/youku1327/article/details/103339617 mybatis初级映射 https://blog.csdn.net/youku1327/article/details/103411829 mybatis配置 https://blog.csdn.net/youku1327/article/details/103604724 当然如果是资深读者,又没有经过系统得学习,可以直接入主本篇,带你一览动态标签使用方式; 动态SQL可以通过给定不同得条件,执行不同得SQL语句,实现动态SQL得方式就是通过mybatis提供得标签语法进行配置; 二 动态SQL标签 2.1 if 标签 if 标签表示条件判断 customer_name 不为空时会执行当前if标签的内容;此时的sql 语句 就是 select * from customer where and customer_name = #{customer_name} gender不为空时会执行if语句;此时执行的sql语句就是 select * from customer where 1 = 1 and gender = #{gender}

mybaits-plus总结

孤人 提交于 2020-02-04 15:39:58
import java.math.BigDecimal; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.enums.SqlLike; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.ebc.numen.Application; import com.ebc

【转载】DevOps Checklist

自古美人都是妖i 提交于 2020-02-04 14:13:23
来源:转载 时间:2017-11-08 DevOps is the integration of development, quality assurance, and IT operations into a unified culture and set of processes for delivering software. Use this checklist as a starting point to assess your DevOps culture and process. Culture Ensure business alignment across organizations and teams . Conflicts over resources, purpose, goals, and priorities within an organization can be a risk to successful operations. Ensure that the business, development, and operations teams are all aligned. Ensure the entire team understands the software lifecycle . Your team needs to