C++进阶-STL set/multiset容器和map容器的简单认识

set/multiset容器的简单认识

    • set基本概念
      • set与multiset 的区别:
      • set容器的构造和赋值
      • set容器的大小和交换
      • set容器的插入与删除
      • set容器的查找和统计
      • set容器-set和multiset的区别
      • set容器内置类型指定排序规则
      • set容器自定义数据类型指定排序规则
    • pair对组创建
    • map容器的基本概念
      • map容器构造和赋值
      • map容器大小和交换
      • map容器插入和删除
      • map容器查找和统计
      • map容器排序

set基本概念

set的所有元素在插入时会自动被排序,其本质 set/multiset 属于并联式容器,底层结构是用二叉树实现的

set与multiset 的区别:

  • set不允许容器中有重复的元素
  • multiset允许容器中有重复的元素

使用时仅需要包含一个 set 的头文件

#include <set>

set容器的构造和赋值

  • set<T> st; 默认构造函数
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main()
{
	//默认构造函数
	set<int> st;
	st.insert(12);
}
  • set(const set<T>& st); 拷贝构造函数
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main()
{
	//默认构造函数
	set<int> st;
	st.insert(12);
	//拷贝构造函数
	set<int> st2(st);
}
  • set& operator=(const set<T>& st); 重载等号操作符
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main()
{
	//默认构造函数
	set<int> st;
	st.insert(12);
	set<int> st2;
	//重载等号操作符赋值
	st2 = st;
}

set容器的大小和交换

用于统计set容器的大小以及交换set容器

  • size(); 返回容器中元素的数目
在这里插入代码片
  • empty(); 判断容器是否为空
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main()
{
	set<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
	}
	string str = (((int)st.empty()) == 0) ? "不为空" : "为空";
	std::cout << "容器st是否为空: " << str << std::endl;
}

在这里插入图片描述

  • swap(st); 交换两个集合容器
#include <iostream>
#include <string>
#include <set>
using namespace std;

void printf(const set<int> st)
{
	for (set<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main()
{
	set<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
	}
	set<int> st2;
	for (int i = 11; i < 20; i++)
	{
		st2.insert(i);
	}
	std::cout << "执行交换前 st的数据信息为:" << std::endl;
	printf(st);
	std::cout << "执行交换前 st2的数据信息为:" << std::endl;
	printf(st2);
	st.swap(st2);
	std::cout << "执行交换后 st的数据信息为:" << std::endl;
	printf(st);
	std::cout << "执行交换后 st2的数据信息为:" << std::endl;
	printf(st2);
}

执行结果

set容器的插入与删除

  • insert(elem); 在容器中插入元素
#include <iostream>
#include <string>
#include <set>
using namespace std;

void printf(const set<int> st)
{
	for (set<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main()
{
	set<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
	}
	std::cout << "插入数据后 st的数据信息为:" << std::endl;
	printf(st);
	for (int i =100; i > 90; i--)
	{
		st.insert(i);
	}
	std::cout << "插入数据后 st的数据信息为:" << std::endl;
	printf(st);
}

运行结果
以上案例说明set容器在插入元素后,会进行排序

  • clear(); 清除所有元素
#include <iostream>
#include <string>
#include <set>
using namespace std;

void printf(const set<int> st)
{
	for (set<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main()
{
	set<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
	}
	std::cout << "插入数据后 st的数据信息为:" << std::endl;
	printf(st);
	st.clear();
	std::cout << "清空数据据后 st的数据信息为:" << std::endl;
	printf(st);
}

执行结果

  • erase(pos); 删除pos迭代器所指的元素,返回下一个元素速度迭代器
#include <iostream>
#include <string>
#include <set>
using namespace std;

void printf(const set<int> st)
{
	for (set<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main()
{
	set<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
	}
	std::cout << "插入数据后 st的数据信息为:" << std::endl;
	printf(st);
	set<int>::iterator it = st.erase(st.begin());
	std::cout << "删除st.begin元素后 返回的下一元素位置指向:" << *it << std::endl;
	std::cout << "删除st.begin元素后 set容器值列表为:" << std::endl;
	printf(st);
}

执行结果

  • erase(beg, end); 删除区间[beg, end)的所有元素,返回下一个元素的迭代器
#include <iostream>
#include <string>
#include <set>
using namespace std;

void printf(const set<int> st)
{
	for (set<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main()
{
	set<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
	}
	std::cout << "插入数据后 st的数据信息为:" << std::endl;
	printf(st);
	set<int>::iterator it = st.erase(st.begin(), ++(++st.begin()));
	std::cout << "删除[st.begin, ++(++st.begin()))元素后 返回的下一元素位置指向:" << *it << std::endl;
	std::cout << "删除元素后 set容器值列表为:" << std::endl;
	printf(st);
}

执行结果

  • earse(elem); 删除容器中值为elem的元素
#include <iostream>
#include <string>
#include <set>
using namespace std;

void printf(const set<int> st)
{
	for (set<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main()
{
	set<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
	}
	std::cout << "插入数据后 st的数据信息为:" << std::endl;
	printf(st);
	st.erase(1);
	std::cout << "删除元素 1 后 set容器值列表为:" << std::endl;
	printf(st);
}

执行结果

set容器的查找和统计

  • find(key); 查找key是否存在,若存在,返回该key值的元素的迭代器,若不存在,返回 set.end();
#include <iostream>
#include <string>
#include <set>
using namespace std;

void printf(const set<int> st)
{
	for (set<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main()
{
	set<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
	}
	std::cout << "插入数据后 st的数据信息为:" << std::endl;
	printf(st);
	
	set<int>::iterator it = st.find(1);
	std::cout << "查找元素 1 的位置:" << &it << " 其指向的元素值为:"  << *it << std::endl;

	set<int>::iterator it_not_find = st.find(100);
	if (it_not_find == st.end())
	{
		std::cout << "元素100 未查找到" << std::endl;
	}
}

执行结果

  • count(key); 统计元素key的个数
#include <iostream>
#include <string>
#include <set>
using namespace std;

void printf(const multiset<int> st)
{
	for (multiset<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main()
{
	multiset<int> st;
	for (int i = 0; i < 10; i++)
	{
		st.insert(i);
		st.insert(i);
		st.insert(i);
	}
	std::cout << "插入数据后 st的数据信息为:" << std::endl;
	printf(st);
	
	int count = st.count(1);
	std::cout << "统计元素 1 的数量,元素共有:" << count << " 个:" << std::endl;
}

执行结果
这里使用multiset举例,因为set不会存储重复插入的元素,所有元素数量均为1个

set容器-set和multiset的区别

  • set不可以插入重复数据,而multiset可以插入重复数据
  • set插入数据的同时会返回插入结果,表示插入是否成功
  • multiset不会监测数据,因此可以插入重复数据
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main()
{
	set<int> st;
	pair<set<int>::iterator, bool> ret = st.insert(3);
	if (ret.second)
	{
		std::cout << "插入成功" << std::endl;
	}
	else
	{
		std::cout << "插入失败" << std::endl;
	}
	ret = st.insert(3);
	if (ret.second)
	{
		std::cout << "插入成功" << std::endl;
	}
	else
	{
		std::cout << "插入失败" << std::endl;
	}
}

执行结果
内部使用的 pair<set<int>::iterator, bool> 是一个键值对的结构,调用set.insert() 后,会触发重复值监测,如果检测到重复值,那么会导致返回插入失败的结果
multiset没有这个操作

set容器内置类型指定排序规则

set容器默认排序规则是从小到大,利用仿函数,可以改变排序规则

#include <iostream>
#include <string>
#include <set>
#include <ctime>
using namespace std;

class CustomCompare
{
public:
	//数据可能被修改,所以需要使用const限定调用函数的set对象不被修改
	bool operator()(int v1, int v2) const
	{
		return v1 > v2;
	}
};

void printf(const set<int>& st)
{
	for (set<int>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

void printf_custom(set<int, CustomCompare>& st)
{
	for (set<int, CustomCompare>::iterator it = st.begin(); it != st.end(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

void init(set<int>& st)
{
	//随机数种子
	srand((unsigned int)time(NULL));
	for (int i = 0; i < 10; i++)
	{
		st.insert(rand() % 60 + 40);
	}
}

int main()
{
	set<int> st;
	init(st);
	std::cout << "初始化set后的值(当前是默认升序排列):" << std::endl;
	printf(st);

	//指定排序规则为从大到小 - 需要在创建容器的时候指定
	set<int, CustomCompare> st2;
	st2.insert(12);
	st2.insert(14);
	st2.insert(54);
	st2.insert(34);
	st2.insert(76);
	std::cout << "初始化set后的值(当前是定义了自定义仿函数排序规则):" << std::endl;
	printf_custom(st2);
}

运行结果

set容器自定义数据类型指定排序规则

#include <iostream>
#include <string>
#include <set>
#include <ctime>
using namespace std;

class Person
{
private:
	string m_Name;
	int m_Age;
public:
	Person(string name, int age)
	{
		this->m_Name = name;
		this->m_Age = age;
	}
	void printf() const
	{
		std::cout << "姓名:" << this->m_Name << " 年龄:" << this->m_Age << std::endl;
	}
	int getAge()
	{
		return this->m_Age;
	}
};

class PersonCompare
{
public:
	bool operator()(Person p1, Person p2) const
	{
		return p1.getAge() > p2.getAge();
	}
};

void printf(const set<Person, PersonCompare>& st)
{
	for (set<Person, PersonCompare>::const_iterator it = st.begin(); it != st.end(); it++)
	{
		it->printf();
	}
}

int main()
{
	set<Person, PersonCompare> st;
	Person p1("张三",12);
	Person p2("李四", 54);
	Person p3("王二", 23);
	Person p4("麻子", 87);
	Person p5("刘武", 45);
	Person p6("无硫", 22);

	st.insert(p1);
	st.insert(p2);
	st.insert(p3);
	st.insert(p4);
	st.insert(p5);
	st.insert(p6);
	printf(st);
}

执行结果

pair对组创建

成对出现的数据,利用对组可以返回两个数据

两种创建方式:

  • pair<type, type> p (value, value2);
  • pair<type, type> p = make_pair(value, value2);
#include <iostream>
#include <string>
using namespace std;

int main()
{
	pair<string, int> p1("测试Pair", 111);
	std::cout << "插入的值为:(" << p1.first << ", " << p1.second << ")" << std::endl;
	p1 = make_pair("测试pair第二次", 121);
	std::cout << "插入的值为:(" << p1.first << ", " << p1.second << ")" << std::endl;
}

执行结果

map容器的基本概念

  • map中所有元素都是pair
  • pair中的第一个元素是key(键值),起到索引所用,第二个元素是value(实值)
  • 所有元素都会根据元素的键值自动排列

本质:

  • map/multimap 属于并联式容器,底层结构是用二叉树实现

优点:

  • 可以根据key值快速查找到value值

map和multimap 的区别:

  • map不允许容器中有重复的key值元素
  • multimap允许容器中有重复的key值元素

map容器构造和赋值

  • map<T1, T2> mp; 默认构造函数
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
	//默认构造函数
	map<string, int> mp;
}
  • map(const map<T1, T2>& mp); 拷贝构造函数
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
	//默认构造函数
	map<string, int> mp;
	//拷贝构造
	map<string, int> mp2(mp);
}
  • map& operator=(const map& map); 重载等号操作符
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
	//默认构造函数
	map<string, int> mp;
	//重载=号赋值
	map<string, int> mp2 = mp;
}

map容器大小和交换

  • size(); 返回容器中的元素的数目
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
	map<string, int> mp;
	std::cout << mp.size() << std::endl;
}
  • empty(); 判别容器中元素是否为空
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
	map<string, int> mp;
	mp.insert(pair<string,int>("测试", 12));
	std::cout << mp.empty() << std::endl;
}
  • swap(st); 交换两个集合容器
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
	map<string, int> mp;
	map<string, int> mp2;
	mp.swap(mp2);
}

map容器插入和删除

  • insert(elem); 在容器中插入元素
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
	map<string, int> mp;
	//第一种方法
	mp.insert(pair<string,int>("测试", 12));
	//第二种方法
	mp.insert(make_pair("测试2", 12));
	//第三种方法
	mp.insert(map<int, int>::value_type("测试3", 12))
	//第四种 不建议使用 没有这个key值调用时,会根据您的key值创建一个信息数据出来并填充默认值
	mp["测试5"] = 13for(map<string, int>::iterator it = mp.begin(); it != mp.end(); it++)
	{
		std::cout << "(" << (*it).first << " ," << (*it).second << ")" << std::endl; 
	}
}
  • clear(); 清除所有元素
map<string, int> mp;
mp.insert(pair<string,int>("测试", 12));
mp.clear();
  • erase(pos); 删除pos迭代器所指的元素,返回下一个元素的迭代器
map<string, int> mp;
mp.insert(pair<string,int>("测试", 12));
map<string, int>::iterator next = mp.erase(mp.begin());
  • erase(beg, end); 删除[beg, end)区间所有的元素,返回下一个元素的迭代器
map<string, int> mp;
mp.insert(pair<string,int>("测试", 12));
map<string, int>::iterator next = mp.erase(mp.begin(), mp.end());
  • erase(key); 删除容器中key值为key的元素
map<string, int> mp;
mp.insert(pair<string,int>("测试", 12));
mp.erase(12);

map容器查找和统计

  • find(key); 查找key是否存在,若存在,返回该键的元素的迭代器,若不存在,返回map.end();
map<string, int> mp;
mp.insert(pair<string, int>("测试", 12));
map<string, int>::iterator find_result = mp.find("测试");
if (find_result == mp.end())
{
	std::cout << "未查找" << std::endl;
}
else
{
	std::cout << "查找到结果" << std::endl;
}
  • count(key); 统计key元素个数
multimap <string, int> mp;
mp.insert(pair<string, int>("测试", 12));
mp.insert(pair<string, int>("测试", 13));
int count =  mp.count("测试");
std::cout << "查找到结果" <<  count << "个" << std::endl;

map容器排序

利用仿函数,改变排序规则

#include <iostream>
#include <string>
#include <map>
using namespace std;

class Compare
{
public:
	bool operator()(string k1, string k2) const
	{
		return k1 > k2;
	}
};

int main()
{
	multimap <string, int , Compare> mp;
	mp.insert(pair<string, int>("测试1", 12));
	mp.insert(pair<string, int>("测试2", 13));
	
	for (map<string, int>::iterator it = mp.begin(); it != mp.end(); it++)
	{
		std::cout << "(" << (*it).first << ", " << (*it).second << ")" << std::endl;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/135251.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

数据拟合、参数估计、插值等数据处理算法

介绍 数据拟合&#xff1a; 数据拟合是通过选择或构建合适的函数模型&#xff0c;将给定的数据点与该函数模型进行匹配和拟合的过程。常见的数据拟合方法包括最小二乘法和非线性最小二乘法。最小二乘法通过最小化实际数据与拟合函数的残差平方和来求解最优拟合参数。非线性最小…

在AutoDL云环境上训练Stable Diffusion Lora模型

AutoDL官网&#xff1a; AutoDL算力云 | 弹性、好用、省钱。租GPU就上AutoDLAutoDL为您提供专业的GPU租用服务&#xff0c;秒级计费、稳定好用&#xff0c;高规格机房&#xff0c;7x24小时服务。更有算法复现社区&#xff0c;一键复现算法。https://www.autodl.com/ 新建实例…

2023最新最全【Adobe After Effection 2023】下载安装零基础教程【附安装包】

AE2023下载点这里 教学 1.鼠标右击【Ae2023(64bit)】压缩包选择&#xff08;win11系统需先点击“显示更多选项”&#xff09;【解压到 Ae2023(64bit)】。 2.打开解压后的文件夹&#xff0c;鼠标右击【Set-up】选择【以管理员身份运行】。 3.点击【文件夹图标】&#xff0c;…

【数据结构】:红黑树

1、红黑树的简介 红黑树&#xff08;Red Black Tree&#xff09; 是一种自平衡二叉查找树&#xff0c;是在计算机科学中用到的一种数据结构。 红黑树是在1972年由Rudolf Bayer发明的&#xff0c;当时被称为平衡二叉B树&#xff08;symmetric binary B-trees&#xff09;。后来…

基于LDA主题分析的《老友记》情景喜剧数据集的建模分析(文末送书)

&#x1f935;‍♂️ 个人主页&#xff1a;艾派森的个人主页 ✍&#x1f3fb;作者简介&#xff1a;Python学习者 &#x1f40b; 希望大家多多支持&#xff0c;我们一起进步&#xff01;&#x1f604; 如果文章对你有帮助的话&#xff0c; 欢迎评论 &#x1f4ac;点赞&#x1f4…

进程状态和优先级

文章目录 进程状态Linux中具体的进程状态僵尸进程孤儿进程 进程优先级 正文开始前给大家推荐个网站&#xff0c;前些天发现了一个巨牛的 人工智能学习网站&#xff0c; 通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家。 点击跳转到网站。 进程状态 进程在操…

图解算法数据结构-LeetBook-数组03_除本身之外乘积

为了深入了解这些生物群体的生态特征&#xff0c;你们进行了大量的实地观察和数据采集。数组 arrayA 记录了各个生物群体数量数据&#xff0c;其中 arrayA[i] 表示第 i 个生物群体的数量。请返回一个数组 arrayB&#xff0c;该数组为基于数组 arrayA 中的数据计算得出的结果&am…

AI驱动的软件测试,何时可以信赖?

综合编译&#xff5c;TesterHome社区 作者&#xff5c;Yuliya Vasilko&#xff0c;数据工程师 以下为作者观点&#xff1a; 越来越多的组织转向人工智能&#xff08;AI&#xff09;驱动的测试解决方案&#xff0c;以简化质量保证流程并提高软件可靠性。 随着对人工智能的依赖程…

动态规划题解

文章目录 杨辉三角杨辉三角2爬楼梯最小花费爬楼梯斐波那契数列比特位计数不同路径 杨辉三角 var generate function(numRows) {//先定义一个空数组var ret[];//遍历行数for(let i 0;i<numRows;i){var cownew Array(i1).fill(1)//定义行内数组数&#xff0c;有多少numrows&a…

[N-133]基于springboot,vue小说网站

开发工具&#xff1a;IDEA 服务器&#xff1a;Tomcat9.0&#xff0c; jdk1.8 项目构建&#xff1a;maven 数据库&#xff1a;mysql5.7 系统分前后台&#xff0c;项目采用前后端分离 前端技术&#xff1a;vueelementUI 服务端技术&#xff1a;springbootmybatis-plus 本项…

幼教早教内容付费预约小程序的效果如何

很多家庭对孩子的重视程度很高&#xff0c;尤其加之如今激烈竞争的市场&#xff0c;孩子从小便需要各种提前教育&#xff0c;而相关教培企业也比较多&#xff0c;基于服务高需求度&#xff0c;线下教育与线上课程教育同样重要。 在实际经营中&#xff0c;幼教早教培训机构也面…

关于我用半个月过了软件设计师这件事

文章底部有个人公众号&#xff1a;热爱技术的小郑。主要分享开发知识、学习资料、毕业设计指导等。有兴趣的可以关注一下。为何分享&#xff1f; 踩过的坑没必要让别人在再踩&#xff0c;自己复盘也能加深记忆。利己利人、所谓双赢。 前言 有关考取软件设计师证书的好处我就不在…

JAIN SIP API详解与GB28181服务器实现

目录 JAIN SIP API 摘要 关于JAIN SIP API API概述 maven坐标 类/接口 Message接口 Request接口 Response接口 即时通讯程序 TextClient代码概述 Message Processor SIP协议栈 发送SIP请求 发送会话消息 接收SIP响应 接收SIP请求 处理错误 总结 GB28181SIP…

HDRP图形入门:HDRP渲染管线depth翻转

新项目开坑HDRP渲染管线&#xff0c;花了些时间把项目开发框架和图形工作流更新到最新版本&#xff0c;其间发现HDRP中深度信息和buildin渲染管线翻转了。 以前的buildin渲染管线&#xff0c;距离摄像机越近depth->0&#xff0c;越远depth->1&#xff0c;这也很好理…

2.3 CE修改器:浮点数扫描

本关需要使用 Cheat Engine 工具对浮点数进行扫描&#xff0c;完成修改任务。浮点数是一种带有小数点的数值&#xff0c;通过“浮点数”扫描方式进行修改。本关中&#xff0c;健康值为单精度浮点数&#xff0c;弹药值为双精度浮点数&#xff0c;需要将这两项数值都修改为 5000 …

【Linux】八、进程通信

进程通信的介绍 目的 数据传输&#xff1a;一个进程将它的数据发送给另一个进程&#xff1b; 资源共享&#xff1a;多个进程间共享资源&#xff1b; 通知事件&#xff1a;一个进程向另一个或一组进程发送消息&#xff0c;同时事件如&#xff0c;进程终止时要通知父进程&#xf…

web前端开发第一次Dreamweave课堂练习/html练习代码《社会主义核心价值观》

目标图片&#xff1a; 文字素材&#xff1a; 社会主义核心价值观 Socialist Core Values 富强、民主、文明、和谐是国家层面的价值目标。 自由、平等、公正、法治是社会层面的价值取向。 爱国、敬业、诚信、友善是公民个人层面的价值准则。 Core socialist values are the…

联系作者方式的教程

首先你应该目前是在付费资源运行效果的展示文章页面&#xff0c;如下所示 然后一直往下滑&#xff0c;滑到这个文章的最下面&#xff0c;就可以看到我的推广名片&#xff0c;最后点击这个名片就可以获取到我的联系方式了~

[云原生案例2.4 ] Kubernetes的部署安装 【通过Kubeadm部署Kubernetes高可用集群】

文章目录 1. 基本架构及前置准备1.1 基本架构1.2 前置准备 2. 系统初始化操作 ---- 所有节点2.1 关闭防火墙、selinux和swap分区2.1.1 关闭防火墙和selinux2.1.2 关闭交换分区 2.2 修改主机名&#xff0c;添加域名映射2.2.1 修改主机名2.2.2 修改本地hosts文件 2.3 内核升级2.4…

MGA-WPA

作者未提供代码
最新文章