当前位置: 首页 > news >正文

Ansible 实战

Ansible 实战

1. httpd 角色

  • 目录
root@ubuntu1904:~#tree  -f httpd/
httpd
├── httpd/default
│   └── httpd/default/main.yml
├── httpd/files
│   ├── httpd/files/httpd.conf
│   └── httpd/files/index.html
├── httpd/handlers
│   └── httpd/handlers/main.yml
├── httpd/tasks
│   ├── httpd/tasks/config.yml
│   ├── httpd/tasks/index.yml
│   ├── httpd/tasks/install.yml
│   ├── httpd/tasks/main.yml
│   ├── httpd/tasks/remove.yml
│   └── httpd/tasks/service.yml
├── httpd/templates
│   └── httpd/templates/httpd.conf.j2
└── httpd/vars└── httpd/vars/main.yml
  • 各文件内容

httpd/tasks/main.yml

---
#- include: remove.yml
- include: install.yml
- include: config.yml
- include: index.yml
- include: service.yml

httpd/tasks/install.yml

---
- name: install httpdyum: name=httpd

httpd/tasks/config.yml

---
- name: configtemplate: src=httpd.conf.j2 dest=/etc/httpd/conf/httpd.conf backup=yesnotify: restart

httpd/tasks/index.yml

---
- name: indexcopy: src=index.html dest=/var/www/html

httpd/tasks/service.yml

---
- name: start serviceservice: name=httpd enabled=yes state=started

httpd/handlers/main.yml

---
- name: restartservice: name=httpd state=restarted

httpd/tasks/remove.yml

# remove httpd
- hosts: websrvsremote_user: roottasks:- name: remove httpd packageyum: name=httpd state=absent- name: remove apache useruser: name=apache state=absent- name: remove data filefile: name=/etc/httpd  state=absent
...

httpd/templates/httpd.conf.j2

ServerRoot "/etc/httpd"
Listen {{ 80 }}
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />AllowOverride noneRequire all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">AllowOverride None# Allow open access:Require all granted
</Directory>
<Directory "/var/www/html">Options Indexes FollowSymLinksAllowOverride NoneRequire all granted
</Directory>
<IfModule dir_module>DirectoryIndex index.html index.php index.htm
</IfModule>
<Files ".ht*">Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn<IfModule log_config_module>LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedLogFormat "%h %l %u %t \"%r\" %>s %b" common<IfModule logio_module># You need to enable mod_logio.c to use %I and %OLogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio</IfModule>CustomLog "logs/access_log" combined
</IfModule><IfModule alias_module>ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">AllowOverride NoneOptions NoneRequire all granted
</Directory><IfModule mime_module>TypesConfig /etc/mime.typesAddType application/x-compress .ZAddType application/x-gzip .gz .tgzAddType text/html .shtmlAddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8<IfModule mime_magic_module>MIMEMagicFile conf/magic
</IfModule>
#EnableMMAP off
EnableSendfile on# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf

role_httpd.yml

root@ubuntu1904:/data/ansible_exercise#cat role_httpd.yml
---
- hosts: websrvsremote_user: rootroles:- role: httpd

2. nginx 角色

  • 目录
root@ubuntu1904:/data/ansible_exercise/roles#tree nginx/ -f
nginx
├── nginx/default
│   └── nginx/default/main.yml
├── nginx/files
│   ├── nginx/files/index.html
│   └── nginx/files/nginx.repo
├── nginx/handlers
│   └── nginx/handlers/main.yml
├── nginx/tasks
│   ├── nginx/tasks/config.yml
│   ├── nginx/tasks/file.yml
│   ├── nginx/tasks/install.yml
│   ├── nginx/tasks/main.yml
│   ├── nginx/tasks/repo.yml
│   └── nginx/tasks/service.yml
├── nginx/templates
│   ├── nginx/templates/nginx7.conf.j2
│   └── nginx/templates/nginx8.conf.j2
└── nginx/vars└── nginx/vars/main.yml
  • 各文件内容

nginx/tasks/main.yml

---
- include: repo.yml
- include: install.yml
- include: config.ymltags: config
- include: file.yml
- include: service.yml

nginx/tasks/repo.yml

---
- name: copy yum repo for nginxcopy: src=nginx.repo dest=/etc/yum.repos.d/notify: yum repolisttags: repo

nginx/tasks/install.yml

---
- name: installyum: name=nginx

nginx/tasks/config.yml

---
- name: config file for 7template: src=nginx7.conf.j2 dest=/etc/nginx/nginx.confwhen: ansible_distribution_major_version=="7"notify: restart
- name: config file for 8template: src=nginx8.conf.j2 dest=/etc/nginx/nginx.confwhen: ansible_distribution_major_version=="8"notify: restart

nginx/tasks/file.yml

---
- name: index.htmlcopy: src=index.html dest=/usr/share/nginx/html/

nginx/tasks/service.yml

---
- name: serviceservice: name=nginx state=started enabled=yes

nginx/handlers/main.yml

---
- name: yum repolistshell: yum clean all
- name: restartservice: name=nginx state=restarted

nginx/files/nginx.repo

[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[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

nginx/files/index.html

<DOCTYPE! html><head><p1>Hello There!</p1></head><body><a>A test message!!</a></body></DOCTYPE!
>

nginx/templates/nginx7.conf.j2

user  {{ user }};
worker_processes  {{ ansible_processor_vcpus**2 }};error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;events {worker_connections  1024;
}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;
}

nginx/templates/nginx8.conf.j2

user nginx;
worker_processes  {{ ansible_processor_vcpus**2 }};error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;events {worker_connections  1024;
}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;
}

nginx/vars/main.yml

---
user: daemon

role_nginx.yml

root@ubuntu1904:/data/ansible_exercise#cat role_nginx.yml
---
- hosts: websrvsremote_user: rootroles:- role: nginx

3. memcached 角色

  • 目录
root@ubuntu1904:/data/ansible_exercise/roles#tree memcached/ -f
memcached
├── memcached/default
├── memcached/handlers
├── memcached/tasks
│   ├── memcached/tasks/config.yml
│   ├── memcached/tasks/install.yml
│   ├── memcached/tasks/main.yml
│   └── memcached/tasks/service.yml
├── memcached/templates
│   └── memcached/templates/memcached.j2
└── memcached/vars
  • 各文件内容

memcached/tasks/main.yml

- include: install.yml
- include: config.yml
- include: service.yml

memcached/tasks/install.yml

- name: installyum: name=memcached

memcached/tasks/config.yml

- name: config filetemplate: src=memcached.j2  dest=/etc/sysconfig/memcached

memcached/tasks/service.yml

- name: serviceservice: name=memcached state=started enabled=yes

memcached/templates/memcached.j2

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="{{ ansible_memtotal_mb//4 }}"
OPTIONS=""

role_memcached.yml

root@ubuntu1904:/data/ansible_exercise#cat role_memcached.yml
---
- hosts: websrvsroles:- role: memcached

4. mysql 角色

  • 目录
root@ubuntu1904:/data/ansible_exercise#tree roles/mysqld/ -f
roles/mysqld
├── roles/mysqld/default
├── roles/mysqld/files
│   ├── roles/mysqld/files/my.cnf
│   ├── roles/mysqld/files/mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz
│   └── roles/mysqld/files/secure_mysql.sh
├── roles/mysqld/handlers
│   └── roles/mysqld/handlers/main.yml
├── roles/mysqld/tasks
│   ├── roles/mysqld/tasks/config.yml
│   ├── roles/mysqld/tasks/data.yml
│   ├── roles/mysqld/tasks/group.yml
│   ├── roles/mysqld/tasks/install.yml
│   ├── roles/mysqld/tasks/link.yml
│   ├── roles/mysqld/tasks/main.yml
│   ├── roles/mysqld/tasks/path.yml
│   ├── roles/mysqld/tasks/remove_mysql.yml
│   ├── roles/mysqld/tasks/secure.yml
│   ├── roles/mysqld/tasks/service.yml
│   ├── roles/mysqld/tasks/unarchive.yml
│   └── roles/mysqld/tasks/user.yml
├── roles/mysqld/templates
└── roles/mysqld/vars└── roles/mysqld/vars/mysql_vars.yml
  • 各文件内容

roles/mysqld/tasks/main.yml

---
- include: install.yml
- include: group.yml
- include: user.yml
- include: unarchive.yml
- include: link.yml
- include: data.yml
- include: config.yml
- include: service.yml
- include: path.yml
- include: secure.yml

roles/mysqld/tasks/config.yml

- name: config my.cnfcopy: src=my.cnf  dest=/etc/my.cnf

roles/mysqld/tasks/data.yml

- name: data dirshell: chdir=/usr/local/mysql/  ./scripts/mysql_install_db --datadir=/data/mysql --user=mysql

roles/mysqld/tasks/group.yml

- name: create mysql groupgroup: name=mysql gid=666

roles/mysqld/tasks/install.yml

- name: install deps libsyum: name=libaio,perl-Data-Dumper,perl-Getopt-Long

roles/mysqld/tasks/link.yml

- name: mkdir /usr/local/mysqlfile: src=/usr/local/mysql-5.6.46-linux-glibc2.12-x86_64 dest=/usr/local/mysql state=link

roles/mysqld/tasks/path.yml

- name: PATH variablecopy: content='PATH=/usr/local/mysql/bin:$PATH' dest=/etc/profile.d/mysql.sh

roles/mysqld/tasks/remove_mysql.yml


roles/mysqld/tasks/secure.yml

- name: secure scriptscript: secure_mysql.sh

roles/mysqld/tasks/service.yml

- name: service scriptshell: /bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld;/etc/init.d/mysqld start;chkconfig --add mysqld;chkconfig mysqld on

roles/mysqld/tasks/unarchive.yml

- name: copy tar to remote host and file modeunarchive: src=mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz dest=/usr/local/ owner=root group=root

roles/mysqld/tasks/user.yml

- name: create mysql useruser: name=mysql uid=667 group=mysql shell=/sbin/nologin system=yes create_home=no home=/data/mysql

roles/mysqld/handlers/main.yml

- name: restartshell: /etc/init.d/mysqld restart

roles/mysqld/files/my.cnf

[mysqld]
log-bin
socket=/data/mysql/mysql.sock
user=mysql
symbolic-links=0
datadir=/data/mysql
innodb_file_per_table=1[client]
port=3306
socket=/data/mysql/mysql.sock[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/data/mysql/mysql.pid

roles/mysqld/files/secure_mysql.sh

#!/bin/bash
/usr/local/mysql/bin/mysql_secure_installation <<EOFy
stevenux
stevenux
y
y
y
y
EOF

role_mysqld.yml

root@ubuntu1904:/data/ansible_exercise#cat role_mysqld.yml
---
- hosts: websrvsremote_user: rootroles:- role: mysqldtags: ["mysql", "db"]

5. PXC 角色

  • 目录

  • 配置文件可在我的 github 得到

    Github-ansible_exercise

  • github 中目录如下

root@ubuntu1904:/data/ansible_exercise#tree
.
├── common_scripts
│   ├── loop.sh
│   ├── show_dir.sh
│   └── systeminfo.sh
├── README.rst
├── role_httpd.yml
├── role_memcached.yml
├── role_mysqld.retry
├── role_mysqld.yml
├── role_nginx.retry
├── role_nginx.yml
├── role_pxc.yml
└── roles├── httpd│   ├── default│   │   └── main.yml│   ├── files│   │   ├── httpd.conf│   │   └── index.html│   ├── handlers│   │   └── main.yml│   ├── tasks│   │   ├── config.yml│   │   ├── index.yml│   │   ├── install.yml│   │   ├── main.yml│   │   ├── remove.yml│   │   └── service.yml│   ├── templates│   │   └── httpd.conf.j2│   └── vars├── memcached│   ├── default│   ├── handlers│   ├── tasks│   │   ├── config.yml│   │   ├── install.yml│   │   ├── main.yml│   │   └── service.yml│   ├── templates│   │   └── memcached.j2│   └── vars├── mysqld│   ├── default│   ├── files│   │   ├── my.cnf│   │   ├── mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz│   │   └── secure_mysql.sh│   ├── handlers│   │   └── main.yml│   ├── tasks│   │   ├── config.yml│   │   ├── data.yml│   │   ├── group.yml│   │   ├── install.yml│   │   ├── link.yml│   │   ├── main.yml│   │   ├── path.yml│   │   ├── remove_mysql.yml│   │   ├── secure.yml│   │   ├── service.yml│   │   ├── unarchive.yml│   │   └── user.yml│   ├── templates│   └── vars│       └── mysql_vars.yml├── nginx│   ├── default│   │   └── main.yml│   ├── files│   │   ├── index.html│   │   └── nginx.repo│   ├── handlers│   │   └── main.yml│   ├── tasks│   │   ├── config.yml│   │   ├── file.yml│   │   ├── install.yml│   │   ├── main.yml│   │   ├── repo.yml│   │   └── service.yml│   ├── templates│   │   ├── nginx7.conf.j2│   │   └── nginx8.conf.j2│   └── vars│       └── main.yml├── pxc│   ├── default│   │   └── main.yml│   ├── files│   │   ├── percona.repo│   │   └── wsrep.cnf│   ├── handlers│   │   └── main.yml│   ├── tasks│   │   ├── install_pxc.retry│   │   ├── install_pxc.yml│   │   └── main.yml│   ├── templates│   └── vars│       └── main.yml└── self_report├── self_report.j2├── self_report.retry└── self_report.yml

相关文章:

Ansible 实战

Ansible 实战 1. httpd 角色 目录 rootubuntu1904:~#tree -f httpd/ httpd ├── httpd/default │ └── httpd/default/main.yml ├── httpd/files │ ├── httpd/files/httpd.conf │ └── httpd/files/index.html ├── httpd/handlers │ └── http…...

三、单元测试

三、单元测试 好的单元测试必须遵守 AIR 原则 A&#xff1a;Automatic&#xff08;自动化&#xff09;I&#xff1a;Independent&#xff08;独立性&#xff09;R&#xff1a;Repeatable&#xff08;可重复&#xff09; 单元测试应该是全自动执行的&#xff0c;并且非交互式的…...

“Spring管理JavaBean的过程及Bean的生命周期“

目录 引言1.弹簧容器2. Bean的生命周期2.1 配置javaBean2.2. 解析Bean的定义2.3 检查是否需要添加自己的功能2.4 初始化2.5 实现Aware接口2.6 扩展2.7. 销毁 3. 单例模式和原型模式3.1. 单例模式3.2. 原型模式 4. 总结 引言 Spring框架是一个非常流行的Java应用程序框架&#…...

@mouseover不起作用,并没有触发

我的错误代码如下&#xff1a; <el-rowv-for"version in item.version_list":key"version.id":class"{ blue-background: versionItem.id version.id }"mouseover.native"version.isHovered true"mouseleave.native"version…...

Vue 2 组件注册

组件名的命名规则 定义组件名的两种方式&#xff1a; 短横线分隔命名&#xff0c;Kebab Case&#xff0c;例如my-component-name。单词首字母大写命名&#xff0c;Pascal Case&#xff0c;例如MyComponentName。 第一种方式在模板中使用<my-component-name>引用该元素…...

学习游戏开发引擎,打造梦想中的虚拟世界!

游戏开发引擎是游戏开发过程中的关键工具&#xff0c;它们提供了开发者所需的各种功能和资源&#xff0c;加速了游戏的制作过程。以下是一些常用的游戏开发引擎以及它们的优势&#xff1a; Unity&#xff08;Unity3D&#xff09;&#xff1a; 优势&#xff1a; Unity 是目前最…...

AI搜索引擎助力科学家创新

开发者希望通过帮助科学家从大量文献中发现联系从而解放科学家&#xff0c;让他们专注于发现和创新。 图片来源&#xff1a;The Project Twins 对于专注于历史的研究者Mushtaq Bilal来说&#xff0c;他在未来科技中投入了大量时间。 Bilal在丹麦南部大学&#xff08; Universit…...

神经网络基础-神经网络补充概念-50-学习率衰减

概念 学习率衰减&#xff08;Learning Rate Decay&#xff09;是一种优化算法&#xff0c;在训练深度学习模型时逐渐减小学习率&#xff0c;以便在训练的后期更加稳定地收敛到最优解。学习率衰减可以帮助在训练初期更快地靠近最优解&#xff0c;而在接近最优解时减小学习率可以…...

android.system.ErrnoException: open failed: EPERM (Operation not permitted)

android 10(Q)开始增加了沙盒机制&#xff0c;不能直接把文件保存到/sdcard目录下&#xff0c;只能保存到APP专属目录下&#xff1b;AndroidManifest.xml在标签下增加属性【android:requestLegacyExternalStorage“true”】可以暂时保存到/sdcard路径下&#xff0c;但是Android…...

基于 KubeSphere 的应用容器化在智能网联汽车领域的实践

公司简介 某国家级智能网联汽车研究中心成立于 2018 年&#xff0c;是担当产业发展咨询与建议、共性技术研发中心、创新成果转化的国家级创新平台&#xff0c;旨在提高我国在智能网联汽车及相关产业在全球价值链中的地位。 目前着力建设基于大数据与云计算的智能汽车云端运营…...

面试之ReentrantLock

一&#xff0c;ReentrantLock 1.ReentrantLock是什么&#xff1f; ReentrantLock实现了Lock接口&#xff0c;是一个可重入且独占式的锁&#xff0c;和Synchronized关键字类似&#xff0c;不过ReentrantLock更灵活&#xff0c;更强大&#xff0c;增加了轮询、超时、中断、公平锁…...

系统学习Linux-MongoDB

概述 mongodb是一个nosql数据库&#xff0c;它有高性能、无模式、文档型的特点。是nosql数据库中功能最丰富&#xff0c;最像关系数据库的。数据库格式为BSON 相关概念实例&#xff1a;系统上运行的mongodb的进程&#xff0c;类似于mysql实例&#xff1b;库&#xff1a;每个数…...

【带着学Pytorch】2、张量(Tensor)的介绍与创建

一、Tensor介绍 1.1、 张量是什么? 最开始在出现CPU和GPU, GPU出现主要解决的问题时并行计算,在此基础上的软件层面的工作基本上围绕着并行计算进行的,张量也不例外。 首先,我们先来聊聊 编程语言,python,java ,C,C++等,他们都有的共同特点是什么?在大学中计算机类…...

UniApp 制作高德地图插件

1、下载Uni插件项目 在Uni官网下载Uni插件项目&#xff0c;并参考官网插件项目创建插件项目. 开发者须知 | uni小程序SDK 如果下载下来项目运行不了可以参考下面链接进行处理 UniApp原生插件制作_wangdaoyin2010的博客-CSDN博客 2、引入高德SDK 2.1 在高德官网下载对应SD…...

C# 图像处理之灰色图转化为RGB图像

咨询通义千问的“C# 图像处理之灰色图转化为RGB图像”结果&#xff0c;看看如何&#xff1a; 在C#中&#xff0c;可以使用Image类来处理图像。要将灰色图像转换为RGB图像&#xff0c;可以按照以下步骤进行操作&#xff1a; 1.创建一个灰色图像对象。 Image grayImage Imag…...

从零实战SLAM-第八课(非特征点的视觉里程计)

在七月算法报的班&#xff0c;老师讲的蛮好。好记性不如烂笔头&#xff0c;关键内容还是记录一下吧&#xff0c;课程入口&#xff0c;感兴趣的同学可以学习一下。 --------------------------------------------------------------------------------------------------------…...

Azure使用CLI创建VM

使用CLI创建VM之前&#xff0c;确保资源中的IP资源已经释放掉了&#xff0c;避免创建的过程中没有可以利用的公共IP地址打开 cloudshell ,并输入创建CLI的命令如下&#xff0c;-n指定名称&#xff0c;-g指定资源组&#xff0c;image指定镜像&#xff0c;admin-usernam指定用户名…...

Rust: 聊聊AtomicPtr<()>和 *const ()

在Bytes库在github源码&#xff08;https://docs.rs/bytes/1.1.0/src/bytes/bytes.rs.html#94-100&#xff09;有关Bytes的定义中&#xff0c; pub struct Bytes {ptr: *const u8,len: usize, // inlined "trait object"data: AtomicPtr<()>, vtable: &st…...

公网远程连接Redis数据库详解

文章目录 1. Linux(centos8)安装redis数据库2. 配置redis数据库3. 内网穿透3.1 安装cpolar内网穿透3.2 创建隧道映射本地端口 4. 配置固定TCP端口地址4.1 保留一个固定tcp地址4.2 配置固定TCP地址4.3 使用固定的tcp地址连接 前言 洁洁的个人主页 我就问你有没有发挥&#xff0…...

天津报web前端培训班一定要选贵的吗?

根据这几年数据显示&#xff0c;IT行业飞速发展&#xff0c;岗位需求增多&#xff0c;Web前端是个很新的职业&#xff0c;在国内乃至国际上真正开始受到重视的时间不超过五年&#xff0c;Web前端开发是从网页制作演变而来&#xff0c;名称是有很明显的时代特性。 Web前端就业形…...

XML Group端口详解

在XML数据映射过程中&#xff0c;经常需要对数据进行分组聚合操作。例如&#xff0c;当处理包含多个物料明细的XML文件时&#xff0c;可能需要将相同物料号的明细归为一组&#xff0c;或对相同物料号的数量进行求和计算。传统实现方式通常需要编写脚本代码&#xff0c;增加了开…...

React Native 导航系统实战(React Navigation)

导航系统实战&#xff08;React Navigation&#xff09; React Navigation 是 React Native 应用中最常用的导航库之一&#xff0c;它提供了多种导航模式&#xff0c;如堆栈导航&#xff08;Stack Navigator&#xff09;、标签导航&#xff08;Tab Navigator&#xff09;和抽屉…...

【Java学习笔记】Arrays类

Arrays 类 1. 导入包&#xff1a;import java.util.Arrays 2. 常用方法一览表 方法描述Arrays.toString()返回数组的字符串形式Arrays.sort()排序&#xff08;自然排序和定制排序&#xff09;Arrays.binarySearch()通过二分搜索法进行查找&#xff08;前提&#xff1a;数组是…...

将对透视变换后的图像使用Otsu进行阈值化,来分离黑色和白色像素。这句话中的Otsu是什么意思?

Otsu 是一种自动阈值化方法&#xff0c;用于将图像分割为前景和背景。它通过最小化图像的类内方差或等价地最大化类间方差来选择最佳阈值。这种方法特别适用于图像的二值化处理&#xff0c;能够自动确定一个阈值&#xff0c;将图像中的像素分为黑色和白色两类。 Otsu 方法的原…...

从零开始打造 OpenSTLinux 6.6 Yocto 系统(基于STM32CubeMX)(九)

设备树移植 和uboot设备树修改的内容同步到kernel将设备树stm32mp157d-stm32mp157daa1-mx.dts复制到内核源码目录下 源码修改及编译 修改arch/arm/boot/dts/st/Makefile&#xff0c;新增设备树编译 stm32mp157f-ev1-m4-examples.dtb \stm32mp157d-stm32mp157daa1-mx.dtb修改…...

论文浅尝 | 基于判别指令微调生成式大语言模型的知识图谱补全方法(ISWC2024)

笔记整理&#xff1a;刘治强&#xff0c;浙江大学硕士生&#xff0c;研究方向为知识图谱表示学习&#xff0c;大语言模型 论文链接&#xff1a;http://arxiv.org/abs/2407.16127 发表会议&#xff1a;ISWC 2024 1. 动机 传统的知识图谱补全&#xff08;KGC&#xff09;模型通过…...

Caliper 配置文件解析:config.yaml

Caliper 是一个区块链性能基准测试工具,用于评估不同区块链平台的性能。下面我将详细解释你提供的 fisco-bcos.json 文件结构,并说明它与 config.yaml 文件的关系。 fisco-bcos.json 文件解析 这个文件是针对 FISCO-BCOS 区块链网络的 Caliper 配置文件,主要包含以下几个部…...

Unsafe Fileupload篇补充-木马的详细教程与木马分享(中国蚁剑方式)

在之前的皮卡丘靶场第九期Unsafe Fileupload篇中我们学习了木马的原理并且学了一个简单的木马文件 本期内容是为了更好的为大家解释木马&#xff08;服务器方面的&#xff09;的原理&#xff0c;连接&#xff0c;以及各种木马及连接工具的分享 文件木马&#xff1a;https://w…...

论文笔记——相干体技术在裂缝预测中的应用研究

目录 相关地震知识补充地震数据的认识地震几何属性 相干体算法定义基本原理第一代相干体技术&#xff1a;基于互相关的相干体技术&#xff08;Correlation&#xff09;第二代相干体技术&#xff1a;基于相似的相干体技术&#xff08;Semblance&#xff09;基于多道相似的相干体…...

数据结构:递归的种类(Types of Recursion)

目录 尾递归&#xff08;Tail Recursion&#xff09; 什么是 Loop&#xff08;循环&#xff09;&#xff1f; 复杂度分析 头递归&#xff08;Head Recursion&#xff09; 树形递归&#xff08;Tree Recursion&#xff09; 线性递归&#xff08;Linear Recursion&#xff09;…...