高可用k8s集群(k8s-1.29.2)

0、高可用k8s集群(k8s-1.29.2)

文章目录

      • 0、高可用k8s集群(k8s-1.29.2)
      • 0、环境准备(centos-7.9、rocky-9.3 环境配置+调优)
      • 1、nginx + keepalived(负载均衡+高可用)
            • 1.1、nginx
            • 1.2、keepalived
      • 2、安装containerd-1.6.28(官方源)(centos-7.9、rocky-9.3 )
      • 3、安装k8s(kubeadm-1.29.2、kubelet-1.29.2、kubectl-1.29.2)(官方源)(centos-7.9、rocky-9.3 )
      • 4、初始化 k8s-1.29.2 集群
      • 5、安装 k8s 集群网络(calico)
      • 6、coredns 解析测试是否正常
      • 7、k8s-node节点后期的加入命令(按照上面操作安装好containerd、kubeadm、kubelet、kubectl)

containerd-1.6.28 + k8s-1.29.2(最新)(kubeadm方式)(containerd容器运行时版)

kubeadm方式安装最新版k8s-1.29.2(containerd容器运行时)

containerd-1.6.28 + k8s-1.29.2(最新)(kubeadm方式)

containerd-1.6.28

k8s-1.29.2

  • k8s-master1(centos-7.9)(4c8g-200g)
  • k8s-master2(centos-7.9)(4c8g-200g)
  • k8s-master3(centos-7.9)(4c8g-200g)
  • k8s-node1(centos-7.9)(8c16g-200g)
  • k8s-node2(rocky-9.3)(8c16g-200g)
  • k8s-node3(rocky-9.3)(8c16g-200g)

主机规划

ip
k8s-master1192.168.1.201nginx+keepalived
k8s-master2192.168.1.203nginx+keepalived
k8s-master3192.168.1.205nginx+keepalived
vip192.168.1.10

网络分配

网络名称网段
Node网络192.168.1.0/24
Service网络10.96.0.0/12
Pod网络10.244.0.0/16

0、环境准备(centos-7.9、rocky-9.3 环境配置+调优)

# 颜色
echo "PS1='\[\033[35m\][\[\033[00m\]\[\033[31m\]\u\[\033[33m\]\[\033[33m\]@\[\033[03m\]\[\033[35m\]\h\[\033[00m\] \[\033[5;32m\]\w\[\033[00m\]\[\033[35m\]]\[\033[00m\]\[\033[5;31m\]\\$\[\033[00m\] '" >> ~/.bashrc && source ~/.bashrcecho 'PS1="[\[\e[33m\]\u\[\e[0m\]\[\e[31m\]@\[\e[0m\]\[\e[35m\]\h\[\e[0m\]:\[\e[32m\]\w\[\e[0m\]] \[\e[33m\]\t\[\e[0m\] \[\e[31m\]Power\[\e[0m\]=\[\e[32m\]\!\[\e[0m\] \[\e[35m\]^0^\[\e[0m\]\n\[\e[95m\]公主请输命令^0^\[\e[0m\] \[\e[36m\]\\$\[\e[0m\] "' >> ~/.bashrc && source ~/.bashrc# 0、centos7 环境配置
# 安装 vim
yum -y install vim wget net-tools# 行号
echo "set nu" >> /root/.vimrc# 搜索关键字高亮
sed -i "8calias grep='grep --color'" /root/.bashrc# 腾讯源
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo-bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
wget -O /etc/yum.repos.d/CentOS-Epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repoyum clean all
yum makecache
# 1、设置主机名
hostnamectl set-hostname k8s-master1 && su -
hostnamectl set-hostname k8s-master2 && su -
hostnamectl set-hostname k8s-master3 && su -
hostnamectl set-hostname k8s-node1 && su -
hostnamectl set-hostname k8s-node2 && su -
hostnamectl set-hostname k8s-node3 && su -
# 2、添加hosts解析
cat >> /etc/hosts << EOF
192.168.1.201 k8s-master1
192.168.1.203 k8s-master2
192.168.1.205 k8s-master3
192.168.1.101 k8s-node1
192.168.1.102 k8s-node2
192.168.1.103 k8s-node3
EOF
# 3、同步时间
yum -y install ntpsystemctl enable ntpd --now
# 4、永久关闭seLinux(需重启系统生效)
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
# 5、永久关闭swap(需重启系统生效)
swapoff -a  # 临时关闭
sed -i 's/.*swap.*/#&/g' /etc/fstab # 永久关闭
# 6、升级内核为5.4版本(需重启系统生效)
# https://elrepo.org/tiki/kernel-lt
# https://elrepo.org/linux/kernel/el7/x86_64/RPMS/rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-6.el7.elrepo.noarch.rpmyum --disablerepo="*" --enablerepo="elrepo-kernel" list availableyum --enablerepo=elrepo-kernel install -y kernel-ltgrub2-set-default 0
# 这里先重启再继续
# reboot
# 7、关闭防火墙、清空iptables规则
systemctl disable firewalld && systemctl stop firewalldiptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X && iptables -P FORWARD ACCEPT
# 8、关闭 NetworkManager
systemctl disable NetworkManager && systemctl stop NetworkManager
# 9、加载IPVS模块
yum -y install ipset ipvsadmmkdir -p /etc/sysconfig/modules
cat > /etc/sysconfig/modules/ipvs.modules <<EOF
modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack
EOFmodprobe -- nf_conntrackchmod 755 /etc/sysconfig/modules/ipvs.modules && bash /etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -e nf_conntrack
# 10、开启br_netfilter、ipv4 路由转发
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOFsudo modprobe overlay
sudo modprobe br_netfilter# 设置所需的 sysctl 参数,参数在重新启动后保持不变
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables  = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward                 = 1
EOF# 应用 sysctl 参数而不重新启动
sudo sysctl --system# 查看是否生效
lsmod | grep br_netfilter
lsmod | grep overlaysysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward
# 11、内核调优
cat > /etc/sysctl.d/99-sysctl.conf << 'EOF'
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).# Controls IP packet forwarding# Controls source route verification
net.ipv4.conf.default.rp_filter = 1# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0# Controls the System Request debugging functionality of the kernel# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536net.ipv4.conf.all.promote_secondaries = 1
net.ipv4.conf.default.promote_secondaries = 1
net.ipv6.neigh.default.gc_thresh3 = 4096kernel.sysrq = 1
net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.default.disable_ipv6=0
net.ipv6.conf.lo.disable_ipv6=0
kernel.numa_balancing = 0
kernel.shmmax = 68719476736
kernel.printk = 5
net.core.rps_sock_flow_entries=8192
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.ip_local_reserved_ports=60001,60002
net.core.rmem_max=16777216
fs.inotify.max_user_watches=524288
kernel.core_pattern=core
net.core.dev_weight_tx_bias=1
net.ipv4.tcp_max_orphans=32768
kernel.pid_max=4194304
kernel.softlockup_panic=1
fs.file-max=3355443
net.core.bpf_jit_harden=1
net.ipv4.tcp_max_tw_buckets=32768
fs.inotify.max_user_instances=8192
net.core.bpf_jit_kallsyms=1
vm.max_map_count=262144
kernel.threads-max=262144
net.core.bpf_jit_enable=1
net.ipv4.tcp_keepalive_time=600
net.ipv4.tcp_wmem=4096 12582912    16777216
net.core.wmem_max=16777216
net.ipv4.neigh.default.gc_thresh1=2048
net.core.somaxconn=32768
net.ipv4.neigh.default.gc_thresh3=8192
net.ipv4.ip_forward=1
net.ipv4.neigh.default.gc_thresh2=4096
net.ipv4.tcp_max_syn_backlog=8096
net.bridge.bridge-nf-call-iptables=1
net.ipv4.tcp_rmem=4096  12582912        16777216
EOF# 应用 sysctl 参数而不重新启动
sudo sysctl --system
# 12、设置资源配置文件
cat >> /etc/security/limits.conf << 'EOF'
* soft nofile 100001
* hard nofile 100002
root soft nofile 100001
root hard nofile 100002
* soft memlock unlimited
* hard memlock unlimited
* soft nproc 254554
* hard nproc 254554
* soft sigpending 254554
* hard sigpending 254554
EOFgrep -vE "^\s*#" /etc/security/limits.confulimit -a

1、nginx + keepalived(负载均衡+高可用)

1.1、nginx
cat > /etc/yum.repos.d/nginx.repo << 'EOF'
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOF
yum install nginx -ymv /etc/nginx/nginx.conf /etc/nginx/nginx.conf-bak
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf-bak
cat > /etc/nginx/nginx.conf << "EOF"
user  nginx;
worker_processes  auto;error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;events {worker_connections  10240;
}stream {log_format  main  '$remote_addr $upstream_addr - [$time_local] $status $upstream_bytes_sent';access_log  /var/log/nginx/k8s-access.log  main;upstream k8s-apiserver {server 192.168.1.201:6443 weight=5 max_fails=1 fail_timeout=3s;  	#k8s-master1的IP和6443端口server 192.168.1.203:6443 weight=5 max_fails=1 fail_timeout=3s;  	#k8s-master2的IP和6443端口server 192.168.1.205:6443 weight=5 max_fails=1 fail_timeout=3s;  	#k8s-master3的IP和6443端口}server {listen 9443; #监听的是9443端口proxy_pass k8s-apiserver; #使用proxy_pass模块进行反向代理}
}http {include       /etc/nginx/mime.types;default_type  application/octet-stream;log_format  main  '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';access_log  /var/log/nginx/access.log  main;sendfile        on;#tcp_nopush     on;keepalive_timeout  65;#gzip  on;include /etc/nginx/conf.d/*.conf;
}
EOF
systemctl enable --now nginx
systemctl status nginx
netstat -tnlp |grep 9443
1.2、keepalived
yum -y install keepalivedcp /etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf-bak

k8s-master1(keepalived的MASTER配置)

cat > /etc/keepalived/keepalived.conf << EOF
! Configuration File for keepalivedglobal_defs {router_id LVS_k8s
}vrrp_script check_nginx {script "/etc/keepalived/check_nginx.sh"interval 3weight -2fall 10rise 2
}vrrp_instance VI_1 {state MASTER # masterinterface ens33# 网卡virtual_router_id 51priority 100 # 权重advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.1.10 # vip}track_script {check_nginx}
}
EOF

k8s-master2(keepalived的BACKUP配置)

cat > /etc/keepalived/keepalived.conf << EOF
! Configuration File for keepalivedglobal_defs {router_id LVS_k8s
}vrrp_script check_nginx {script "/etc/keepalived/check_nginx.sh"interval 3weight -2fall 10rise 2
}vrrp_instance VI_1 {state BACKUP # slaveinterface ens33 # 网卡virtual_router_id 51priority 90 # 权重advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.1.10 # vip}track_script {check_nginx}
}
EOF

k8s-master3(keepalived的BACKUP配置)

cat > /etc/keepalived/keepalived.conf << EOF
! Configuration File for keepalivedglobal_defs {router_id LVS_k8s
}vrrp_script check_nginx {script "/etc/keepalived/check_nginx.sh"interval 3weight -2fall 10rise 2
}vrrp_instance VI_1 {state BACKUP # slaveinterface ens33 # 网卡virtual_router_id 51priority 80 # 权重advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.1.10 # vip}track_script {check_nginx}
}
EOF
systemctl enable --now keepalivedsystemctl status keepalived
cat > /etc/keepalived/check_nginx.sh << 'EOF'
#!/bin/bash
# NGINX down
num=`ps -ef | grep nginx | awk '{print $1}' | grep nginx | wc -l`
if [ $num -eq 0 ];thensystemctl start nginxsleep 1if [ `ps -ef | grep nginx | awk '{print $1}' | grep nginx | wc -l` -eq 0 ];thensystemctl stop keepalivedfi
fi
EOFchmod +x /etc/keepalived/check_nginx.sh

2、安装containerd-1.6.28(官方源)(centos-7.9、rocky-9.3 )

wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repoyum makecache
yum list containerd.io --showduplicates | sort -r
yum -y install containerd.io-1.6.28
containerd config default | sudo tee /etc/containerd/config.toml# 修改cgroup Driver为systemd
sed -ri 's#SystemdCgroup = false#SystemdCgroup = true#' /etc/containerd/config.toml# 更改sandbox_image
sed -ri 's#registry.k8s.io\/pause:3.6#registry.aliyuncs.com\/google_containers\/pause:3.9#' /etc/containerd/config.toml# 添加镜像加速
# https://github.com/DaoCloud/public-image-mirror
# 1、指定配置文件目录
sed -i 's/config_path = ""/config_path = "\/etc\/containerd\/certs.d\/"/g' /etc/containerd/config.toml
# 2、配置加速
# docker.io 镜像加速
mkdir -p /etc/containerd/certs.d/docker.io
cat > /etc/containerd/certs.d/docker.io/hosts.toml << 'EOF'
server = "https://docker.io" # 源镜像地址[host."https://xk9ak4u9.mirror.aliyuncs.com"] # 阿里-镜像加速地址capabilities = ["pull","resolve"][host."https://docker.m.daocloud.io"] # 道客-镜像加速地址capabilities = ["pull","resolve"][host."https://dockerproxy.com"] # 镜像加速地址capabilities = ["pull", "resolve"][host."https://docker.mirrors.sjtug.sjtu.edu.cn"] # 上海交大-镜像加速地址capabilities = ["pull","resolve"][host."https://docker.mirrors.ustc.edu.cn"] # 中科大-镜像加速地址capabilities = ["pull","resolve"][host."https://docker.nju.edu.cn"] # 南京大学-镜像加速地址capabilities = ["pull","resolve"][host."https://registry-1.docker.io"]capabilities = ["pull","resolve","push"]
EOF# registry.k8s.io 镜像加速
mkdir -p /etc/containerd/certs.d/registry.k8s.io
cat > /etc/containerd/certs.d/registry.k8s.io/hosts.toml << 'EOF'
server = "https://registry.k8s.io"[host."https://k8s.m.daocloud.io"]capabilities = ["pull", "resolve", "push"]
EOF# quay.io 镜像加速
mkdir -p /etc/containerd/certs.d/quay.io
cat > /etc/containerd/certs.d/quay.io/hosts.toml << 'EOF'
server = "https://quay.io"[host."https://quay.m.daocloud.io"]capabilities = ["pull", "resolve", "push"]
EOF# docker.elastic.co镜像加速
mkdir -p /etc/containerd/certs.d/docker.elastic.co
tee /etc/containerd/certs.d/docker.elastic.co/hosts.toml << 'EOF'
server = "https://docker.elastic.co"[host."https://elastic.m.daocloud.io"]capabilities = ["pull", "resolve", "push"]
EOFsystemctl daemon-reloadsystemctl enable containerd --nowsystemctl restart containerd
systemctl status containerd

镜像加速配置无需重启服务,即可生效

#设置crictl
cat << EOF >> /etc/crictl.yaml
runtime-endpoint: unix:///var/run/containerd/containerd.sock
image-endpoint: unix:///var/run/containerd/containerd.sock
timeout: 10
debug: false
EOF

3、安装k8s(kubeadm-1.29.2、kubelet-1.29.2、kubectl-1.29.2)(官方源)(centos-7.9、rocky-9.3 )

cat > /etc/yum.repos.d/kubernetes.repo << 'EOF'
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/
enabled=1
gpgcheck=0
EOFyum makecacheyum -y install kubeadm-1.29.2 kubelet-1.29.2 kubectl-1.29.2systemctl enable --now kubelet

4、初始化 k8s-1.29.2 集群

mkdir ~/kubeadm_init && cd ~/kubeadm_initkubeadm config print init-defaults > kubeadm-init.yamlcat > ~/kubeadm_init/kubeadm-init.yaml << EOF
apiVersion: kubeadm.k8s.io/v1beta3
bootstrapTokens:
- groups:- system:bootstrappers:kubeadm:default-node-tokentoken: abcdef.0123456789abcdefttl: 24h0m0susages:- signing- authentication
kind: InitConfiguration
localAPIEndpoint:advertiseAddress: 192.168.1.201 # 修改自己的ipbindPort: 6443
nodeRegistration:criSocket: unix:///var/run/containerd/containerd.sockimagePullPolicy: IfNotPresentname: k8s-master1taints:- effect: NoSchedulekey: node-role.kubernetes.io/k8s-master
---
apiServer:timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta3
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controlPlaneEndpoint: 192.168.1.10:9443 # 高可用vip的ip
controllerManager: {}
dns: {}
etcd:local:dataDir: /var/lib/etcd
imageRepository: registry.aliyuncs.com/google_containers
kind: ClusterConfiguration
kubernetesVersion: v1.29.2
networking:dnsDomain: cluster.localpodSubnet: 10.244.0.0/16serviceSubnet: 10.96.0.0/12
scheduler: {}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: ipvs
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: systemd
EOF
# 查看所需镜像列表
kubeadm config images list --config kubeadm-init.yamlkubeadm config images list --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.29.2
# 预拉取镜像
kubeadm config images pull --config kubeadm-init.yamlkubeadm config images pull --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.29.2
# 初始化
kubeadm init --config=kubeadm-init.yaml --upload-certs --dry-runkubeadm init --config=kubeadm-init.yaml --upload-certs | tee kubeadm-init.log
# 配置 kubectl
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

5、安装 k8s 集群网络(calico)

查看calico与k8s的版本对应关系

https://docs.tigera.io/calico/3.27/getting-started/kubernetes/requirements

这里k8s-1.29.2,所以使用calico-v3.27.0版本(版本对应很关键)

mkdir -p ~/calico-ymlcd ~/calico-yml && wget https://github.com/projectcalico/calico/raw/v3.27.0/manifests/calico.yaml
1 修改CIDR
- name: CALICO_IPV4POOL_CIDRvalue: "10.244.0.0/16"2 指定网卡
# Cluster type to identify the deployment type- name: CLUSTER_TYPEvalue: "k8s,bgp"
# 下面添加- name: IP_AUTODETECTION_METHODvalue: "interface=ens33,ens160"# ens33为本地网卡名字(自己机器啥网卡就改啥)
# 1 修改CIDR
sed -i 's/192\.168/10\.244/g' calico.yamlsed -i 's/# \(- name: CALICO_IPV4POOL_CIDR\)/\1/' calico.yaml
sed -i 's/# \(\s*value: "10.244.0.0\/16"\)/\1/' calico.yaml
# 2 指定网卡(ens33为本地网卡名字(自己机器啥网卡就改啥))
sed -i '/value: "k8s,bgp"/a \            - name: IP_AUTODETECTION_METHOD' \calico.yamlsed -i '/- name: IP_AUTODETECTION_METHOD/a \              value: "interface=ens33,ens160"' \calico.yaml
kubectl apply -f ~/calico-yml/calico.yaml

6、coredns 解析测试是否正常

[root@k8s-master ~]# kubectl run -it --rm dns-test --image=busybox:1.28.4 sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes
Server:    10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local   # 看到这个说明dns解析正常Name:      kubernetes
Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local
/ #
kubectl run -it --rm dns-test --image=busybox:1.28.4 shkubectl run -it --rm dns-test --image=ccr.ccs.tencentyun.com/huanghuanhui/busybox:1.28.4 sh
nslookup kubernetes

7、k8s-node节点后期的加入命令(按照上面操作安装好containerd、kubeadm、kubelet、kubectl)

kubeadm token listkubeadm token create --print-join-command --dry-runkubeadm token create --print-join-command
kubeadm token listkubeadm init phase upload-certs --upload-certs

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

MATLAB环境下基于洗牌复杂演化的图像分割算法

智能优化算法因其较强的搜索解能力而得到了大量的应用&#xff0c;在这些计算智能算法中&#xff0c;群体智能优化算法因其高效性、有效性以及健壮性等优点而得到了科研人员的青睐。这类算法借鉴生物群体的合作特性&#xff0c;主要解决大规模复杂的分布式问题&#xff0c;研究…

第7.1章:StarRocks性能调优——查询分析

目录 一、查看查询计划 1.1 概述 1.2 查询计划树 1.3 查看查询计划的命令 1.3 查看查询计划 二、查看查询Profile 2.1 启用 Query Profile 2.2 获取 Query Profile 2.3 Query Profile结构与详细指标 2.3.1 Query Profile的结构 2.3.2 Query Profile的合并策略 2.…

WPF Style样式设置

1.本window设置样式 <Window x:Class"WPF_Study.MainWindow"xmlns"http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x"http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d"http://schemas.microsoft.com/expressi…

开源软件:彻底改变软件产业的趋势

开源软件:彻底改变软件产业的趋势 开源软件的兴起彻底改变了软件产业的面貌。作为一种软件开发和许可的新模式,开源软件为用户和开发者带来了前所未有的便利。 开源软件的优势 与传统的商业软件相比,开源软件具有以下独特优势: 低成本:开源软件可以免费获取源代码,大大降低了…

CentOS删除除了最近5个JAR程序外的所有指定Java程序

帮我写一个shell脚本,ps -eo pid,lstart,cmd --sort=-start_time | grep "pgz-admin"查到的结果,返回的所有进程PID,第六个之上的,全部kill 当然,你可以创建一个简单的Shell脚本来完成这个任务。以下是一个例子: #!/bin/bash# 获取包含 "pgz-admin"…

JSONVUE

1.JSON学习 1.概念: JSON是把JS对象变成字符串. 2.作用: 多用于网络中数据传输. JavaScript对象 let person{name:"张三",age:18}//将JS对象转换为 JSON数据let person2JSON{"name":"张三","age":18}; 3.JS对象与JSON字符串转换…

Python爬虫-付费代理推荐和使用

付费代理的使用 相对免费代理来说&#xff0c;付费代理的稳定性更高。本节将介绍爬虫付费代理的相关使用过程。 1. 付费代理分类 付费代理分为两类&#xff1a; 一类提供接口获取海量代理&#xff0c;按天或者按量收费&#xff0c;如讯代理。 一类搭建了代理隧道&#xff0…

中国赛车公园行业市场现状分析与投资前景预测研究报告

全版价格&#xff1a;壹捌零零 报告版本&#xff1a;下单后会更新至最新版本 交货时间&#xff1a;1-2天 第一章赛车公园概述 第一节赛车公园概念及特点 一、赛车公园的定义 赛车主题公园就是以赛车为主题&#xff0c;集餐饮住宿、休闲娱乐多种功能于一体的综合性主题公园…

网络安全的主要威胁及应对方法

大家好我是咕噜美乐蒂&#xff0c;很高兴又和大家见面了&#xff01; 网络安全是当今社会中至关重要的议题&#xff0c;面临着各种各样的威胁和挑战。为了更详细地回答您的问题&#xff0c;下面将分析并提供常见的网络安全威胁以及相应的应对方法。 一、恶意软件&#xff08;…

AR应用的开发流程

增强现实&#xff08;Augmented Reality&#xff0c;AR&#xff09;是一种技术&#xff0c;它将虚拟信息叠加在真实世界中&#xff0c;通过计算机生成的视觉、听觉、触觉等感官反馈&#xff0c;将虚拟元素与现实世界进行交互。这种技术使得用户可以与现实世界中的虚拟对象进行互…

【scala】scala枚举类最佳实现及其jackson序列化方式

参考文章&#xff1a; 官网参考&#xff1a; jackson是支持scala内部的Enumeration的&#xff0c;但是jackson版本需要新一些&#xff0c;比如2.14后。 jackson github jackson-module-scala github enumeratum github scala各个枚举类方式对比&#xff1a; 最好的就是&#…

Windows系统搭建Elasticsearch引擎结合内网穿透实现远程连接查询数据

文章目录 系统环境1. Windows 安装Elasticsearch2. 本地访问Elasticsearch3. Windows 安装 Cpolar4. 创建Elasticsearch公网访问地址5. 远程访问Elasticsearch6. 设置固定二级子域名 Elasticsearch是一个基于Lucene库的分布式搜索和分析引擎&#xff0c;它提供了一个分布式、多…

社交媒体变革者:剖析Facebook对在线互动的贡献

随着数字化时代的蓬勃发展&#xff0c;社交媒体已经成为人们日常生活中不可或缺的一部分。在这个领域的发展中&#xff0c;Facebook作为先行者和领导者&#xff0c;对在线互动的演变和发展产生了深远的影响。本文将深入剖析Facebook在社交媒体领域的贡献&#xff0c;以及它对在…

Python爬虫-爬取B站番剧封面

本文是本人最近学习Python爬虫所做的小练习。如有侵权&#xff0c;请联系删除。 页面获取url 代码 import requests import os import re# 创建文件夹 path os.getcwd() /images if not os.path.exists(path):os.mkdir(path)# 当前页数 page 1 # 总页数 total_page 2# 自动…

项目打包提示一堆 ts 类型错误问题解决

问题 vue3 ts 项目在打包的过程中报了一大堆 ts 类型错误提示&#xff0c;如下图所示&#xff1a; 报错&#xff1a;Could not find a declaration file for module … implicitly has an ‘any’ type. 解决方法 查看 package.json 文件&#xff0c;可以看到&#xff0c;默…

deb文件怎么安装

在Ubuntu中安装.deb文件&#xff0c;你可以使用多种方法&#xff0c;这里介绍两种常见的方法&#xff1a; 方法1&#xff1a;使用dpkg命令 打开终端。 使用cd命令切换到包含.deb文件的目录。 使用dpkg命令安装.deb文件。如果文件名为example.deb&#xff0c;则命令如下&…

企业纷纷投入人员安全建设的主要原因是什么?

随着数字经济、人工智能、区块链、物联网等新技术、新业态、新应用的发展变化&#xff0c;网络犯罪分子的作案手法也在与时俱进不断升级。企业面对复杂多变的网络攻击&#xff0c;必须做好相关防护及人员安全教育。 人为因素或成数据泄露的主要原因 攻击者们大量利用被盗凭据…

Python Pandas将 DataFrame 转换为列表

更多Python学习内容&#xff1a;ipengtao.com 在数据分析和处理过程中&#xff0c;经常会使用到 Pandas 库来处理和操作数据。Pandas 提供了灵活强大的数据结构 DataFrame&#xff0c;它可以存储和处理各种类型的数据&#xff0c;并提供了丰富的方法和函数来进行数据操作。有时…

AtCoder ABC342 A-D题解

华为出的比赛&#xff1f; 好像是全站首个题解哎&#xff01; 比赛链接:ABC342 Problem A: 稍微有点含金量的签到题。 #include <bits/stdc.h> using namespace std; int main(){string S;cin>>S;for(int i0;i<s.size();i){if(count(S.begin(),S.end(),S[i…

C++ STL :红黑树rb_tree源码剖析

STL关联式容器map、set、multimap、multiset&#xff0c;绝大部分操作如插入、修改、删除、搜索&#xff0c;都是由其内含的红黑树来完成的。 红黑树数据结构和算法的讲解见&#xff1a; 数据结构与算法&#xff1a;红黑树讲解-CSDN博客 我下面会总结 STL中rb_tree怎么实现…