06 2020 档案

摘要:网络规划: 仅使用 10.10.14.0, 192.168.10.0 ,192.168.100.0 三个网络, 分别为 外部网络, 隧道网络,管理网络。 vm-workstation:使用三块网卡,分别为 vmnet1-hostonly,vmnet2-hostonly,vmnet0 桥接模式 4台主 阅读全文
posted @ 2020-06-29 15:24 abel2020 阅读(2238) 评论(1) 推荐(0)
摘要:脑子不好使,画个图备忘 阅读全文
posted @ 2020-06-26 02:27 abel2020 阅读(280) 评论(0) 推荐(0)
摘要:linux 学习计划:三剑客 awk,sed,grep shell 编程 6.26-27 系统管理 磁盘管理 进程管理 网络管理 6.30 数据库 mysql 7.1 先了解 服务 httpd nginx 重点 tomcat 7.2-3 运维 zabbix ansible、puppet、cobble 阅读全文
posted @ 2020-06-25 22:21 abel2020 阅读(95) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-06-25 04:34 abel2020 阅读(98) 评论(0) 推荐(0)
摘要:ovs 基础1 添加网桥 # ovs-vsctl addbr br-test2 查看ovs# ovs-vsctl show388cc00d-685d-48a9-a8f4-ba236504dcfa Bridge br-test Port br-test Interface br-test // loo 阅读全文
posted @ 2020-06-24 23:12 abel2020 阅读(747) 评论(0) 推荐(0)
摘要:centos 8 桥接及nic-team: //没发现有什么用 # systemctl restart NetworkManager // nmcli 命令大部分配置可以自动保存为配置文件 // 查看接口(ifname) # nmcli device DEVICE TYPE STATE CONNEC 阅读全文
posted @ 2020-06-24 21:04 abel2020 阅读(398) 评论(0) 推荐(0)
摘要:https://www.cnblogs.com/sammyliu/p/4622563.html 阅读全文
posted @ 2020-06-24 00:44 abel2020 阅读(85) 评论(0) 推荐(0)
摘要:`ovs 安装1 下载 # wget https://www.openvswitch.org/releases/openvswitch-2.12.0.tar.gz2 解压,编译# tar -xzf openvswitch-2.12.0.tar.gz# ../configure# make # mak 阅读全文
posted @ 2020-06-23 22:24 abel2020 阅读(408) 评论(0) 推荐(0)
摘要:命令 解压 tar –xvf *.tar .tar.xz tar –xzf *.tar.gz tar –xZf *.tar.Z tar –xjf *.tar.bz2 x 解压 v 显示过程 f 指定文件 gunzip *.gz unzip *.zip uncompress *.Z 阅读全文
posted @ 2020-06-22 11:49 abel2020 阅读(138) 评论(0) 推荐(0)
摘要:环境: 安装centos 8.1 安装libvirt 相关工具 实验1:理解命名空间,测试不同namespace 通讯 目标拓扑: 192.168.10.1 192.168.10.2 veth1.1 < > veth1.2 ns1 ns2 1 copy vm1.img to /kvm-os 2 编辑 阅读全文
posted @ 2020-06-21 21:22 abel2020 阅读(193) 评论(0) 推荐(0)
摘要:libvirt工具栈: 支持的虚拟化技术:KVM, XEN, VMWARE, Qemu,LXC, OpenVZ; libvirt中的术语: node: 指物理节点 hypervisor: domain: vm instances 安装: # yum install libvirt libvirt-c 阅读全文
posted @ 2020-06-20 19:00 abel2020 阅读(185) 评论(0) 推荐(0)
摘要:搭建环境: host01-5g 192.168.122.201 5g : host02-5g 192.168.122.201 5g : 通过host01 克隆 host00-2g 192.168.122.201 2g : 通过host01 克隆,修改xml 一: host01-5g kvm 部署 一 阅读全文
posted @ 2020-06-16 22:49 abel2020 阅读(131) 评论(0) 推荐(0)
摘要:创建新虚拟机: 方法一: virt-install : qemu-img create host01-centos8.qcow2 -f qcow2 40G virt-install \ --os-type=linux \ --name host01-centos8 \ --ram 4096 \ -- 阅读全文
posted @ 2020-06-16 10:42 abel2020 阅读(201) 评论(0) 推荐(0)
摘要:nginx 常用命令: nginx 目录: # pwd /usr/local/soft/nginx-1.18.0/sbin 查看版本: ./nginx -v 停止 ./nginx -s stop 启动 ./nginx 重新加载配置文件: ./nginx -s reloadnginx配置文件:#use 阅读全文
posted @ 2020-06-15 00:50 abel2020 阅读(64) 评论(0) 推荐(0)
摘要:编译安装: 下载:http://nginx.org/download/nginx-1.18.0.tar.gz 解压:tar -zxvf nginx-1.18.0.tar.gz configure: ./configure --prefix=/usr/local/soft/nginx-1.18.0 - 阅读全文
posted @ 2020-06-14 12:13 abel2020 阅读(170) 评论(0) 推荐(0)
摘要:rpm 安装: 在线查找库依赖 www.rpmfind.net 如搜索 libapr-1.so.0 rpm -q 包名 查询是否安装某包 rpm -qi 查询已安装包的信息 rpm -qa 查询所有安装的rpm包 rpm -ql 查询rpm包安装的路径 -ql -p 查询未安装包的安装的路径 yum 阅读全文
posted @ 2020-06-14 02:51 abel2020 阅读(60) 评论(0) 推荐(0)
摘要:1 准备工作: pcre8.44: https://sourceforge.net/projects/pcre/files/pcre/8.44/pcre-8.44.tar.gz/download httpd-2.4.43.tar.gz : https://mirrors.tuna.tsinghua. 阅读全文
posted @ 2020-06-14 01:29 abel2020 阅读(147) 评论(0) 推荐(0)
摘要:目录命令: ls -a 查看隐藏文件 -l 列 -ld 查看目录 -h 人性化显示大小 -i 显示文件编号 mkdir -p 递归创建 cp -r 复制目录 -p 保留文件属性复制 mount /dev/sr0 /mnt/cdrom 挂载cdrom到/mnt/cdrom 文件处理: touch xx 阅读全文
posted @ 2020-06-13 22:37 abel2020 阅读(125) 评论(0) 推荐(0)
摘要:1 移动命令 行数定位: gg 移动到文件首部 G 移动到文件末尾 15gg 移动到15行 屏幕移动: ctrl b 向前翻页 ctrl f 向后翻页 H 文件头部 M 文件中间 L 文件底部 行移动: 0 移动到行首 w 向后移动一个单词 b 向前移动一个单词 段落移动: { 上 } 下 % 寻找 阅读全文
posted @ 2020-06-13 13:14 abel2020 阅读(163) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-06-12 23:50 abel2020 阅读(128) 评论(0) 推荐(0)
摘要:# #打开文件 file1 = open("test2.py") #默认只读 file2=open("test2.py.copy","w") # w 覆盖写, a 追加,没有文件都会创建 #读取文件 text = file1.read() #写入文件 file2.write(text) #关闭文件 阅读全文
posted @ 2020-06-12 23:43 abel2020 阅读(153) 评论(0) 推荐(0)
摘要:#1 打开文件,open 函数 file1 = open("test2.py") #2读取文件,read text = file1.read() #返回字符串类型 print(text) #3 关闭文件 file1.close() # file1 = open("test2.py") text = 阅读全文
posted @ 2020-06-12 22:59 abel2020 阅读(125) 评论(0) 推荐(0)
摘要:1 新建 python Package : mess 文件夹,自动生成空的 __init__.py ,创建send_mess ,receive_mess 两个测试文件, __init__.py 如下: from . import receive_mess from . import send_mes 阅读全文
posted @ 2020-06-12 18:54 abel2020 阅读(103) 评论(0) 推荐(0)
摘要:#导入模块 #定义全局变量 #定义类 #定义函数 def main(): pass # ... print("测试本py代码") if __name__ == '__main__': # 只有在本次程序中,两个才会相等,下面才会执行 main() 阅读全文
posted @ 2020-06-12 18:31 abel2020 阅读(88) 评论(0) 推荐(0)
摘要:def input_passwd(): pwd=input("请输入密码:") if len(pwd) >=8: return pwd else: # 1 创建异常对象 使用错误信息字符串作为参数:如 密码长度不够 ex=Exception("密码长度不够") #Exception 是py的异常对象 阅读全文
posted @ 2020-06-12 17:23 abel2020 阅读(121) 评论(0) 推荐(0)
摘要:try: #可能出现错误的代码 num=input(("please input number:")) d except error_code1: # 针对错误类型(最后一行第一个单词),执行如下代码 pass except Exception as err_other: print(err_oth 阅读全文
posted @ 2020-06-12 16:48 abel2020 阅读(113) 评论(0) 推荐(0)
摘要:"""类中只有一个对象1 重写new方法 只初始化一次内存2 设置标志位,使init 在多次被执行时,实际代码只被执行一次""" class MusicPlayer(object): instance=None #初始没有对象, 定义类的instance属性,设为空 # new是object类内置的 阅读全文
posted @ 2020-06-12 10:03 abel2020 阅读(120) 评论(0) 推荐(0)
摘要:class Game: top_score=0 #定义类属性 @classmethod #定义类方法,因为要调用类属性 def show_top_score(cls): print("top score :%s "% cls.top_score) @staticmethod #定义静态方法,什么都不 阅读全文
posted @ 2020-06-12 00:57 abel2020 阅读(81) 评论(0) 推荐(0)
摘要:class Animal(object): @staticmethod #定义静态方法,eat 不要调用类的属性,也不要调用对象的属性 def eat(): print("eat") # 静态方法,不需要创建实例对象 Animal.eat() 阅读全文
posted @ 2020-06-12 00:03 abel2020 阅读(76) 评论(0) 推荐(0)
摘要:class Animal(object): count = 0 @classmethod #定义类方法,上一行 def show_count(cls): #定义类方法 cls强制必须,指代Animal类 print("Animal count: %d"%cls.count) #使用cls. 引用co 阅读全文
posted @ 2020-06-11 23:55 abel2020 阅读(109) 评论(0) 推荐(0)
摘要:class Animal(object): #object 是所有类的基类 #定义类的属性 count = 0 def __init__(self,name): self.name=name #每次初始化一个实例,count+1 Animal.count+=1 dog=Animal("dog") c 阅读全文
posted @ 2020-06-11 23:27 abel2020 阅读(123) 评论(0) 推荐(0)
摘要:class Animal: def eat(self): print("eat") def __sleep(self): # __开头的方法是私有的,不能在类定义外面使用,不能被子类调用,但是可以在父类公有方法中调用私有属性或方法,子类就可以间接调用这些私有属性或方法 print("sleep") 阅读全文
posted @ 2020-06-11 21:50 abel2020 阅读(251) 评论(0) 推荐(0)
摘要:class Gun: # 初始化属性,model形参,需要定义对象时传递 def __init__(self, model): self.model = model self.buller_count = 0 # 添加子弹方法 ,添加count发子弹 def add_bullet(self, con 阅读全文
posted @ 2020-06-11 16:31 abel2020 阅读(362) 评论(0) 推荐(0)
摘要:"""房间放入家具 定义Fur类: 包含两个属性 ,name 和size 初始化name和size 定义__str__方法, 修改print 对象的结果 定义House类: 包含四个属性 ,name 和size,area(剩余空间),fur_list(家具列表) 初始化name和size 定义__s 阅读全文
posted @ 2020-06-11 16:04 abel2020 阅读(199) 评论(0) 推荐(0)
摘要:class Cat: #驼峰命名法 def __init__(self,newname): # __init__ 是内置的初始化方法,2个形参,self是对象的引用 #self.属性=形参 self.name=newname #把接收实参,赋值给属性 name, def eat(self): pri 阅读全文
posted @ 2020-06-11 10:32 abel2020 阅读(204) 评论(0) 推荐(0)
摘要:def fun(x): if x==1: return 1 print("before %d" % x) temp=fun(x-1)+x print("after %d" % x) return temp print(fun(5)) 执行结果: before 5before 4before 3bef 阅读全文
posted @ 2020-06-10 16:11 abel2020 阅读(119) 评论(0) 推荐(0)
摘要:函数传递多值参数 定义时,参数使用 * ,可以收元组,使用2个** 可以接收字典调用时,方法1:仍然使用1个或者两个星号方法2:不用星号,使用()或者{} #定义函数时,参数使用* ,可以收元组,使用2个** 可以接收字典 def fun1(*args): num=0 print() for n i 阅读全文
posted @ 2020-06-10 11:28 abel2020 阅读(618) 评论(0) 推荐(0)
摘要:def fun(): t=39 n=100 #return (t,n) return t,n #同上,实际就是使用元组返回 g_t,g_n=fun() #使用多个变量接收,数量要对等 print(g_t,g_n) a=10 b=20 a,b= (b,a) # 交换a,b 同 a,b=(b,a) pr 阅读全文
posted @ 2020-06-10 00:51 abel2020 阅读(124) 评论(0) 推荐(0)
摘要:1 局部变量各函数内部互不影响 2 函数内部与全部变量重名,局部的值有效 (同c) 3 如果需要修改全局变量: 加global , 所有受影响的地方会颜色一致凸显 阅读全文
posted @ 2020-06-10 00:29 abel2020 阅读(268) 评论(0) 推荐(0)
摘要:1 字符串,数字,元组 不可变,改变变量值,内存地址改变 2 列表,字典,可变,操作不会改变地址 3 字典的key 只能用不可变类型(因为py对 key 进行hash ,可变类型不能hash) ##列表操作>>> list=["a",1,2,"b"] >>> id(list) 14038619452 阅读全文
posted @ 2020-06-09 23:51 abel2020 阅读(167) 评论(0) 推荐(0)
摘要:def fun(): s="python" print("%s address is %d" % (s,id(s))) return s f=fun() print("%s address is %d" % (f,id(f))) 运行结果: python address is 30498557801 阅读全文
posted @ 2020-06-09 23:01 abel2020 阅读(284) 评论(0) 推荐(0)
摘要:a=10 print("%d address is %d" % (a,id(a))) def fun(num): print("%d address is %d" % (num,id(num))) fun(a) 运行结果: 10 address is 140706134913584 10 addre 阅读全文
posted @ 2020-06-09 22:46 abel2020 阅读(124) 评论(0) 推荐(0)
摘要:a=1 print("a address is ",id(a)) b=a c=b print("b address is ",id(b)) print("c address is ",id(c)) 打印结果: a address is 140706134913296 #b c a 都指向 1 所在的 阅读全文
posted @ 2020-06-09 22:32 abel2020 阅读(99) 评论(0) 推荐(0)
摘要:************************************************** 欢迎使用 名片管理系统 0. 退出 1. 新建名片 2. 显示全部 3. 查询名片**************************************************请选择:1您选的 阅读全文
posted @ 2020-06-09 18:37 abel2020 阅读(123) 评论(0) 推荐(0)
摘要:''' 我的第一个py小程序 名片处理系统 2020 06 09 main.py ''' #导入功能模块,单词处理每一部分功能 import cards_fun1 while True: #欢迎页面 cards_fun1.hy() # 请用户选择 num_input = input("请选择:") 阅读全文
posted @ 2020-06-09 18:30 abel2020 阅读(313) 评论(0) 推荐(0)
摘要:""" test1.py 注意缩进!! """ def pt_line(char,times,num): row=0 while row<num: print(char * times) row+=1 name ="my first module:" """ test2.py """ import 阅读全文
posted @ 2020-06-08 03:52 abel2020 阅读(107) 评论(0) 推荐(0)
摘要:def pt_line(c,times): #形参 print(c*times) times=5 char="*" row=0 while row<5: pt_line(char,times) # char ,times 实参 row+=1 循环里面的pt_line 执行时,传递参数进入第一行执行, 阅读全文
posted @ 2020-06-08 02:43 abel2020 阅读(92) 评论(0) 推荐(0)
摘要:py 根据缩进确定if 或者while 的范围 while 后面不用括号 ,使用分号 默认print 自动回车,如果不需要回车加上 ,end="" 不支持 i++ i=1;j=1 while i<=9: j=i while j<=9: print("%dX%d=%d "%(i,j,i*j),end= 阅读全文
posted @ 2020-06-08 01:41 abel2020 阅读(237) 评论(0) 推荐(0)
摘要:>>> name=input("input name:") input name:Li ming >>> sex=bool(input("input sex(True,False):")) input sex(True,False):True >>> scale=float(input("input 阅读全文
posted @ 2020-06-07 22:11 abel2020 阅读(114) 评论(0) 推荐(0)
摘要:>>> name=input("input name:") // " " 里面是提示内容,函数返回输入的内容,赋值给变量 input name:lili >>> sex=input("input sex(True,False):") input sex(True,False):False >>> a 阅读全文
posted @ 2020-06-07 21:32 abel2020 阅读(323) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-06-07 20:39 abel2020 阅读(113) 评论(0) 推荐(0)
摘要:''' these are comments my first py prog ''' print("math copute: \n") a=2 b=3 c=a+bd=a**b #### " " 里面原样输出, 多个输出 用 , ############# print("a =",a,", b =" 阅读全文
posted @ 2020-06-07 20:06 abel2020 阅读(202) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-06-07 12:45 abel2020 阅读(109) 评论(0) 推荐(0)
摘要://#include "Header.h" #include <stdio.h> #include <stdbool.h> #include <stdlib.h> //exit 函数需要 #include <malloc.h> #define MAXSIZE 20 //队列长度 #define NO 阅读全文
posted @ 2020-06-07 00:19 abel2020 阅读(245) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define NOINFO -1 typedef struct node { int data; struct TNode* L; struct TNode* R; }Node, 阅读全文
posted @ 2020-06-05 20:55 abel2020 阅读(171) 评论(0) 推荐(0)
摘要://冒泡排序,输入一个数组,冒泡排序 #include <stdio.h> #include<time.h> #include<stdlib.h> # define MAXSIZE 10 //要排序数组的长度 #define random(x) (rand()%x) //宏定义随机数函数 //三个参 阅读全文
posted @ 2020-06-04 23:53 abel2020 阅读(131) 评论(0) 推荐(0)
摘要:#include <stdio.h> char A, B, C; han(int, char, char, char); main() { han(4, 'A', 'B', 'C'); } han(n, A, B, C) { if (1 == n) printf("%d %c-%c\n", n, A 阅读全文
posted @ 2020-06-04 11:00 abel2020 阅读(98) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <stdbool.h> #include <stdlib.h> //exit 函数需要 #include <malloc.h> #define MAXSIZE 8 typedef struct queue { int* arr; //int 类 阅读全文
posted @ 2020-06-03 23:46 abel2020 阅读(169) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <malloc.h> #include <stdbool.h> #include <stdlib.h> typedef struct node //定义节点类型 { int data; struct node* pNext; }*PNODE, 阅读全文
posted @ 2020-06-03 03:35 abel2020 阅读(96) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <stdbool.h> #include <stdlib.h> //exit 函数需要 #include <malloc.h> typedef struct node { struct node* pNext; int data; }*PNOD 阅读全文
posted @ 2020-06-03 01:27 abel2020 阅读(108) 评论(0) 推荐(0)