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

IaC基础设施即代码:使用Terraform 连接 alicloud阿里云

目录

一、实验

1.环境

2.alicloud阿里云创建用户

3.Linux使用Terraform 连接 alicloud

4.Windows使用Terraform 连接 alicloud

二、问题

1.Windows如何申明RAM 相关变量

2.Linux如何申明RAM 相关变量

3. Linux terraform 初始化失败

4.Linux terraform 计划与预览失败

5. Windows terraform 初始化失败

6. Windows terraform plan命令有哪些参数


一、实验

1.环境

(1)主机

表1-1 主机

主机系统软件工具备注
jia

Windows 

Terraform 1.6.6VS Code、 PowerShell
pipepointLinuxTerraform 1.6.6 Chocolatey

2.alicloud阿里云创建用户

(1)登录

RAM 访问控制 (aliyun.com)

(2)查看

RAM访问控制-用户

(3)创建用户 

选中“OpenAPI调用访问”

(4)安全验证

(5)完成创建

(6)添加权限

(7)选择权限,搜索“VPC”

(8)选择权限,搜索“ECS”

(9)授权成功

(10)查看alicloud provider 示例

Terraform Registry

USE PROVIDER  示例

terraform {required_providers {alicloud = {source = "aliyun/alicloud"version = "1.214.1"}}
}provider "alicloud" {# Configuration options
}

Example Usage  示例

# Configure the Alicloud Provider
provider "alicloud" {access_key = "${var.access_key}"secret_key = "${var.secret_key}"region     = "${var.region}"
}data "alicloud_instance_types" "c2g4" {cpu_core_count = 2memory_size    = 4
}data "alicloud_images" "default" {name_regex  = "^ubuntu"most_recent = trueowners      = "system"
}# Create a web server
resource "alicloud_instance" "web" {image_id             = "${data.alicloud_images.default.images.0.id}"internet_charge_type = "PayByBandwidth"instance_type        = "${data.alicloud_instance_types.c2g4.instance_types.0.id}"system_disk_category = "cloud_efficiency"security_groups      = ["${alicloud_security_group.default.id}"]instance_name        = "web"vswitch_id           = "vsw-abc12345"
}# Create security group
resource "alicloud_security_group" "default" {name        = "default"description = "default"vpc_id      = "vpc-abc12345"
}

3.Linux使用Terraform 连接 alicloud

(1)安装

sudo yum install -y yum-utilssudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.reposudo yum -y install terraform

安装yum-utils

添加REPO

安装Terraform

(2)验证版本

terraform version

(3)开启命令行补全

terraform -install-autocomplete

(4)创建项目

mkdir terraformcd terraform/

(5)创建主配置文件

vim main.tf

  1 provider "alicloud" {2   access_key = var.access_key3   secret_key = var.secret_key4   region     = var.region5 }6 7 //VPC 专有网络8 resource "alicloud_vpc" "vpc" {9   vpc_name   = "tf_test"10   cidr_block = "172.16.0.0/12"11 }12 13 //switch 交换机14 resource "alicloud_vswitch" "vsw" {15   vpc_id     = alicloud_vpc.vpc.id16   cidr_block = "172.16.0.0/21"17   zone_id    = "cn-nanjing-a"18 }19 20 //security_group 安全组21 resource "alicloud_security_group" "group" {22   name                = "demo-group"23   vpc_id              = alicloud_vpc.vpc.id24   security_group_type = "normal" //普通类型25 }26 27 //security_group_rule 规则(80端口)28 resource "alicloud_security_group_rule" "allow_80_tcp" {29   type              = "ingress"30   ip_protocol       = "tcp"31   nic_type          = "intranet"32   policy            = "accept"33   port_range        = "80/80"34   priority          = 135   security_group_id = alicloud_security_group.group.id36   cidr_ip           = "0.0.0.0/0"37 }38 39 //security_group_rule 规则(22端口)40 resource "alicloud_security_group_rule" "allow_22_tcp" {41   type              = "ingress"42   ip_protocol       = "tcp"43   nic_type          = "intranet"44   policy            = "accept"45   port_range        = "22/22"46   priority          = 147   security_group_id = alicloud_security_group.group.id48   cidr_ip           = "0.0.0.0/0"49 }

(6)创建变量配置文件

vim variables.tf

  1 variable "access_key" { type = string }2 3 variable "secret_key" { type = string }4 5 variable "region" { type = string }

(7)创建版本配置文件

vim versions.tf

  1 terraform {2   required_version = "1.6.6"3   required_providers {4     alicloud = {5       source  = "aliyun/alicloud"6       version = "1.214.1"7     }8   }9 }10 

(8)初始化

terraform init

(9)申明RAM相关变量

export TF_VAR_access_key="XXXXX"
export TF_VAR_secret_key="XXXXX"
export TF_VAR_region="cn-nanjing"

(9)格式化代码

terraform fmt

(10)验证代码

terraform validate -json

(11)计划与预览

 terraform plan

(12)申请资源

terraform apply

输入yes

查看目录

lstree

(13)展示资源

terraform show

(14)登录阿里云系统查看

VPC

安全组

入方向规则

(15)销毁资源

terraform destroy

ls

输入yes

查看目录

4.Windows使用Terraform 连接 alicloud

(1)验证版本

terraform -v 或 terraform --version

(2)创建主配置文件

main.tf

terraform {required_version = "1.6.6"required_providers {alicloud = {source  = "aliyun/alicloud"version = "1.214.1"}}
}variable "access_key" {description = "access_key"}variable "secret_key" {description = "secret_key"
}variable "region" {description = "阿里云地域"type        = stringdefault     = "cn-nanjing"
}# Configure the Alicloud Provider
provider "alicloud" {access_key = var.access_keysecret_key = var.secret_keyregion     = var.region
}//VPC 专有网络
resource "alicloud_vpc" "vpc" {vpc_name   = "tf_test"cidr_block = "172.16.0.0/12"
}//switch 交换机
resource "alicloud_vswitch" "vsw" {vpc_id     = alicloud_vpc.vpc.idcidr_block = "172.16.0.0/21"zone_id    = "cn-nanjing-a"
}//security_group 安全组
resource "alicloud_security_group" "group" {name                = "demo-group"vpc_id              = alicloud_vpc.vpc.idsecurity_group_type = "normal" //普通类型
}//security_group_rule 规则(80端口)
resource "alicloud_security_group_rule" "allow_80_tcp" {type              = "ingress"ip_protocol       = "tcp"nic_type          = "intranet"policy            = "accept"port_range        = "80/80"priority          = 1security_group_id = alicloud_security_group.group.idcidr_ip           = "0.0.0.0/0"
}//security_group_rule 规则(22端口)
resource "alicloud_security_group_rule" "allow_22_tcp" {type              = "ingress"ip_protocol       = "tcp"nic_type          = "intranet"policy            = "accept"port_range        = "22/22"priority          = 1security_group_id = alicloud_security_group.group.idcidr_ip           = "0.0.0.0/0"
}

(3) 创建变量配置文件

terraform.tfvars

access_key = "XXXXX"
secret_key = "XXXXX"

(4)初始化

terraform init

(5)格式化代码

terraform fmt

(6)验证代码

terraform validate -jsonterraform validate 

(7)计划与预览

 terraform plan

(8)申请资源

terraform apply

输入yes

(9)展示资源

terraform show

(10)登录阿里云系统查看

VPC

安全组

入方向规则

(11)销毁资源

terraform destroy

输入yes

(12)查看版本

多了provider的仓库地址

terraform versionterraform -v

二、问题

1.Windows如何申明RAM 相关变量

(1)申明 (仅测试)

setx  TF_VAR_access_key  XXXXX
setx  TF_VAR_secret_key  XXXXX
setx  TF_VAR_region  cn-nanjing

(2)查看

regedit用户变量:
计算机\HKEY_CURRENT_USER\Environment系统变量:
计算机\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment

注册应用表:

用户变量:

系统变量:

2.Linux如何申明RAM 相关变量

(1)申明

export TF_VAR_access_key="XXXXX"
export TF_VAR_secret_key="XXXXX"
export TF_VAR_region="cn-nanjing"

3. Linux terraform 初始化失败

(1)报错

(2)原因分析

国内用户在下载 Provider 时会遇到下载缓慢甚至下载失败的问题

(3)解决方法

Terraform CLI 自 0.13.2 版本起提供了设置网络镜像的功能。为解决以上问题,阿里云 Provider 提供了镜像服务以帮助国内用户快速下载。

①配置方案

创建.terraformrc 或terraform.rc配置文件,文件位置取决于主机的操作系统。在 Windows 环境上,文件必须命名为terraform.rc,并放置在相关用户的%APPDATA%目录中。这个目录的物理位置取决于Windows 版本和系统配置;在 PowerShell 中使用 $env:APPDATA 可以找到其在系统上的位置。在所有其他系统上,必须将该文件命名为.terraformrc,并直接放在相关用户的主目录中。也可以使用TF_CLI_CONFIG_FILE环境变量指定 Terraform CLI 配置文件的位置,任何此类文件都应遵循命名模式*.tfrc。

②  在home目录下创建.terraformrc文件,内容如下

provider_installation {network_mirror {url = "https://mirrors.aliyun.com/terraform/"// 限制只有阿里云相关 Provider 从国内镜像源下载include = ["registry.terraform.io/aliyun/alicloud", "registry.terraform.io/hashicorp/alicloud",]   }direct {// 声明除了阿里云相关Provider, 其它Provider保持原有的下载链路exclude = ["registry.terraform.io/aliyun/alicloud", "registry.terraform.io/hashicorp/alicloud",]  }
}

③ 新增配置文件

vim .terraformrc
cd terraform/

④ 成功

4.Linux terraform 计划与预览失败

(1)报错

(2)原因分析

环境变量引用失败

(3)解决方法

重新申明变量

export TF_VAR_access_key="XXXXX"
export TF_VAR_secret_key="XXXXX"
export TF_VAR_region="cn-nanjing"

成功:

5. Windows terraform 初始化失败

 (1)报错

显示成功,实际未加载插件

(2)原因分析

国内用户在下载 Provider 时会遇到下载缓慢甚至下载失败的问题

(3)解决方法

Terraform CLI 自 0.13.2 版本起提供了设置网络镜像的功能。为解决以上问题,阿里云 Provider 提供了镜像服务以帮助国内用户快速下载。

①  配置方案

创建.terraformrc 或terraform.rc配置文件,文件位置取决于主机的操作系统。在 Windows 环境上,文件必须命名为terraform.rc,并放置在相关用户的%APPDATA%目录中。这个目录的物理位置取决于Windows 版本和系统配置;在 PowerShell 中使用 $env:APPDATA 可以找到其在系统上的位置。在所有其他系统上,必须将该文件命名为.terraformrc,并直接放在相关用户的主目录中。也可以使用TF_CLI_CONFIG_FILE环境变量指定 Terraform CLI 配置文件的位置,任何此类文件都应遵循命名模式*.tfrc。

② 查看目录

echo $env:APPDATA

③ 进入目录

④在相关目录下创建terraform.rc文件

内容如下:

provider_installation {network_mirror {url = "https://mirrors.aliyun.com/terraform/"// 限制只有阿里云相关 Provider 从国内镜像源下载include = ["registry.terraform.io/aliyun/alicloud", "registry.terraform.io/hashicorp/alicloud",]   }direct {// 声明除了阿里云相关Provider, 其它Provider保持原有的下载链路exclude = ["registry.terraform.io/aliyun/alicloud", "registry.terraform.io/hashicorp/alicloud",]  }
}

⑤ 成功

6. Windows terraform plan命令有哪些参数

(1)语法

PS C:\Gocode\src\TERRAFORM> terraform plan -help                       
Usage: terraform [global options] plan [options]Generates a speculative execution plan, showing what actions Terraformwould take to apply the current configuration. This command will notactually perform the planned actions.You can optionally save the plan to a file, which you can then pass tothe "apply" command to perform exactly the actions described in the plan.Plan Customization Options:The following options customize how Terraform will produce its plan. Youcan also use these options when you run "terraform apply" without passingit a saved plan, in order to plan and apply in a single command.-destroy            Select the "destroy" planning mode, which creates a planto destroy all objects currently managed by thisTerraform configuration instead of the usual behavior.-refresh-only       Select the "refresh only" planning mode, which checkswhether remote objects still match the outcome of themost recent Terraform apply but does not propose anyactions to undo any changes made outside of Terraform.-refresh=false      Skip checking for external changes to remote objectswhile creating the plan. This can potentially makeplanning faster, but at the expense of possibly planningagainst a stale record of the remote system state.-replace=resource   Force replacement of a particular resource instance usingits resource address. If the plan would've normallyproduced an update or no-op action for this instance,Terraform will plan to replace it instead. You can usethis option multiple times to replace more than one object.-target=resource    Limit the planning operation to only the given module,resource, or resource instance and all of itsdependencies. You can use this option multiple times toinclude more than one object. This is for exceptionaluse only.-var 'foo=bar'      Set a value for one of the input variables in the rootmodule of the configuration. Use this option more thanonce to set more than one variable.-var-file=filename  Load variable values from the given file, in additionto the default files terraform.tfvars and *.auto.tfvars.Use this option more than once to include more than onevariables file.Other Options:-compact-warnings          If Terraform produces any warnings that are notaccompanied by errors, shows them in a more compactform that includes only the summary messages.-detailed-exitcode         Return detailed exit codes when the command exits.This will change the meaning of exit codes to:0 - Succeeded, diff is empty (no changes)1 - Errored2 - Succeeded, there is a diff-generate-config-out=path  (Experimental) If import blocks are present inconfiguration, instructs Terraform to generate HCLfor any imported resources not already present. Theconfiguration is written to a new file at PATH,which must not already exist. Terraform may stillattempt to write configuration if the plan errors.-input=true                Ask for input for variables if not directly set.-lock=false                Don't hold a state lock during the operation. Thisis dangerous if others might concurrently runcommands against the same workspace.-lock-timeout=0s           Duration to retry a state lock.-no-color                  If specified, output won't contain any color.-out=path                  Write a plan file to the given path. This can beused as input to the "apply" command.-parallelism=n             Limit the number of concurrent operations. Defaultsto 10.-state=statefile           A legacy option used for the local backend only.See the local backend's documentation for moreinformation.

相关文章:

IaC基础设施即代码:使用Terraform 连接 alicloud阿里云

目录 一、实验 1.环境 2.alicloud阿里云创建用户 3.Linux使用Terraform 连接 alicloud 4.Windows使用Terraform 连接 alicloud 二、问题 1.Windows如何申明RAM 相关变量 2.Linux如何申明RAM 相关变量 3. Linux terraform 初始化失败 4.Linux terraform 计划与预览失败…...

Vue3 如何使用移动端调试工具vConsole

1、安装 pnpm i vconsole2、在src/utils下新建vconsole.ts,写入以下代码 // 这是移动端控制台调试工具,需要调试就打开,不用就注释 import vConsole from vconsole const vconsole new vConsole()3、src/main.ts 引入,需要调试就打开,&…...

【物流管理系统-Python简易版】

前端设计-后端开发(DJango项目Demo) 参考资料:【一文到底】【0基础】【快速上手】Django基本使用 创建项目 Pycharm专业版新建DJango项目 项目文件介绍: django_study_demo │─ manage.py 【项目管理的脚本,不要修…...

Vue学习笔记六--Vue3学习

1、Vue3的优势 2、创建Vue3工程 前提:node -v 查看node版本,需要在16.0及以上 创建命令 npm init vuelatest,先安装create-vue然后创建项目 然后执行npm run dev 提示 sh: vite: command not found,需要执行npm i重新安装依赖,之后再执行np…...

21.在线与离线MC强化学习简介

文章目录 1. 什么是在线MC强化学习2. 什么是离线MC强化学习3. 在线MC强化学习有何缺点 1. 什么是在线MC强化学习 在线强化学习(on-policy MC RL),是指:智能体在策略评估时为获取完整轨迹所采用的采样策略 π s a m p l e ( a ∣ …...

控制网页的灰度显示

1.代码&#xff1a; 普通网页 <style>html {filter: grayscale(100%);}</style> 或是:webkit内核浏览器写法 <style>html {-webkit-filter: grayscale(100%)}</style> 2.说明&#xff1a; grayscale(amount) :进行灰度转换。 amount转换值的大小&…...

科研绘图(四)火山图

火山图是生物信息学中常用的一种图表&#xff0c;用来显示基因表达数据的变化。它通常将每个点表示为一个基因&#xff0c;x轴显示对数比率&#xff08;log ratio&#xff09;&#xff0c;表示基因表达的变化大小&#xff1b;y轴显示-log10(p-value)&#xff0c;表示变化的统计…...

超强站群系统v9.0:最新蜘蛛池优化技术,一键安装,内容无缓存刷新,高效安全

安全、高效&#xff0c;化的优化利用php性能&#xff0c;使得运行流畅稳定 独创内容无缓存刷新不变&#xff0c;节省硬盘。防止搜索引擎识别蜘蛛池 蜘蛛池算法&#xff0c;轻松构建站点&#xff08;电影、资讯、图片、论坛等等&#xff09; 可以个性化每个网站的风格、内容、…...

torch.fx的极简通用量化教程模板

现在比较流行的方式,是使用 torch.fx来做量化,比如地平线J3/J5的oe开发包中内嵌的ptq/qat量化方式,就是基于torch.fix进行开发的。本文将使用100行代码教你入门比较标准的量化步骤。,这些问题需要解答。本文100行代码,麻雀虽小五脏俱全,包括怎么用,用在哪里,哪里不能用…...

rpc的正确打开方式|读懂Go原生net/rpc包

前言 大家好&#xff0c;这里是白泽&#xff0c;之前最近在阅读字节跳动开源RPC框架Kitex的源码&#xff0c;分析了如何借助命令行&#xff0c;由一个IDL文件&#xff0c;生成client和server的脚手架代码&#xff0c;也分析了Kitex的日志组件klog。当然Kitex还有许多其他组件&…...

【信号与系统】【北京航空航天大学】实验二、连续时间系统的时域分析【MATLAB】

一、实验目的 1、掌握连续时间信号的卷积运算以及其对应的 MATLAB 实现方法&#xff1b; 2、掌握连续系统的冲激响应、阶跃响应 以及其对应的 MATLAB 实现方法&#xff1b; 3、掌握利用 MATLAB 求 LTI &#xff08;Linear Time-Invariant, 线性时不变&#xff09;系统响应的方…...

【Linux 内核源码分析笔记】系统调用

在Linux内核中&#xff0c;系统调用是用户空间程序与内核之间的接口&#xff0c;它允许用户空间程序请求内核执行特权操作或访问受保护的内核资源。系统调用提供了一种安全可控的方式&#xff0c;使用户程序能够利用内核功能而不直接访问底层硬件。 系统调用&#xff1a; 通过…...

mysql清空并重置自动递增初始值

需求&#xff1a;当上新项目时&#xff0c;测试环境数据库导出来的表id字段一般都有很大的初始递增值了&#xff0c;需要重置一下 先上代码&#xff1a; -- 查看当前自动递增值 SHOW CREATE TABLE table_name; -- 重建自动递增索引&#xff08;可选&#xff09; ALTER TABLE t…...

计算机算法之二分算法

文章目录 前言核心问题遍历查找思路遍历查找代码实现遍历查找缺点二分查找思路二分查找代码实现二分查找优点二分查找的变种问题一解题思路代码实现问题二解题思路代码实现 前言 大家好&#xff0c;我是醉墨居士&#xff0c;今天聊一下计算机中的经典算法 - 二分算法 核心问题…...

获取当前设备的IP

背景&#xff1a; 在本地使用自带webUI的项目时&#xff0c;需要制定webUI的访问地址。 一般本地访问使用&#xff1a;127.0.0.1&#xff0c;配置为可以从其他设备访问时&#xff0c;需要指定当前设备的IP&#xff0c;或者指定为0.0.0.0。 例如&#xff1a;使用locust的时候&a…...

koa2文件的上传下载功能

const Router require(“koa-router”); const upload new Router(); const bodyParser require(“koa-bodyparser”); const multer require("koa/multer"); const path require(“path”); const article require("…/utils/sql"); const { getCur…...

test-02-test case generate 测试用例生成 EvoSuite 介绍

拓展阅读 junit5 系列 基于 junit5 实现 junitperf 源码分析 Auto generate mock data for java test.(便于 Java 测试自动生成对象信息) Junit performance rely on junit5 and jdk8.(java 性能测试框架。性能测试。压测。测试报告生成。) 拓展阅读 自动生成测试用例 什么…...

1.单表查询

作业要求 素材&#xff1a; 表名&#xff1a;worker-- 表中字段均为中文&#xff0c;比如 部门号 工资 职工号 参加工作 等 CREATE TABLE worker ( 部门号 int(11) NOT NULL, 职工号 int(11) NOT NULL, 工作时间 date NOT NULL, 工资 float(8,2) NOT NULL, 政治面貌 varc…...

FFmpeg 的使用与Docker安装流媒体服务器

本文阐述的均为命令行的使用方式&#xff0c;并不牵扯FFmpeg 的 C音视频开发内容&#xff0c;补充一句&#xff0c;C的资料真的少&#xff0c;能把C学好的人&#xff0c;我真的是觉得巨佬。 我主要是使用FFmpeg 推流方面的知识&#xff0c;案例大都是靠近这方面。 一、FFmpeg…...

Qt QListWidget列表框控件

文章目录 1 属性和方法1.1 外观1.2 添加条目1.3 删除条目1.4 信号和槽 2 实例2.1 布局2.2 代码实现 Qt中的列表框控件&#xff0c;对应的类是QListWidget 它用于显示多个列表项&#xff0c;列表项对应的类是QListWidgetitem 1 属性和方法 QListWidget有很多属性和方法&#xf…...

conda相比python好处

Conda 作为 Python 的环境和包管理工具&#xff0c;相比原生 Python 生态&#xff08;如 pip 虚拟环境&#xff09;有许多独特优势&#xff0c;尤其在多项目管理、依赖处理和跨平台兼容性等方面表现更优。以下是 Conda 的核心好处&#xff1a; 一、一站式环境管理&#xff1a…...

2025年能源电力系统与流体力学国际会议 (EPSFD 2025)

2025年能源电力系统与流体力学国际会议&#xff08;EPSFD 2025&#xff09;将于本年度在美丽的杭州盛大召开。作为全球能源、电力系统以及流体力学领域的顶级盛会&#xff0c;EPSFD 2025旨在为来自世界各地的科学家、工程师和研究人员提供一个展示最新研究成果、分享实践经验及…...

在HarmonyOS ArkTS ArkUI-X 5.0及以上版本中,手势开发全攻略:

在 HarmonyOS 应用开发中&#xff0c;手势交互是连接用户与设备的核心纽带。ArkTS 框架提供了丰富的手势处理能力&#xff0c;既支持点击、长按、拖拽等基础单一手势的精细控制&#xff0c;也能通过多种绑定策略解决父子组件的手势竞争问题。本文将结合官方开发文档&#xff0c…...

unix/linux,sudo,其发展历程详细时间线、由来、历史背景

sudo 的诞生和演化,本身就是一部 Unix/Linux 系统管理哲学变迁的微缩史。来,让我们拨开时间的迷雾,一同探寻 sudo 那波澜壮阔(也颇为实用主义)的发展历程。 历史背景:su的时代与困境 ( 20 世纪 70 年代 - 80 年代初) 在 sudo 出现之前,Unix 系统管理员和需要特权操作的…...

select、poll、epoll 与 Reactor 模式

在高并发网络编程领域&#xff0c;高效处理大量连接和 I/O 事件是系统性能的关键。select、poll、epoll 作为 I/O 多路复用技术的代表&#xff0c;以及基于它们实现的 Reactor 模式&#xff0c;为开发者提供了强大的工具。本文将深入探讨这些技术的底层原理、优缺点。​ 一、I…...

算法笔记2

1.字符串拼接最好用StringBuilder&#xff0c;不用String 2.创建List<>类型的数组并创建内存 List arr[] new ArrayList[26]; Arrays.setAll(arr, i -> new ArrayList<>()); 3.去掉首尾空格...

Selenium常用函数介绍

目录 一&#xff0c;元素定位 1.1 cssSeector 1.2 xpath 二&#xff0c;操作测试对象 三&#xff0c;窗口 3.1 案例 3.2 窗口切换 3.3 窗口大小 3.4 屏幕截图 3.5 关闭窗口 四&#xff0c;弹窗 五&#xff0c;等待 六&#xff0c;导航 七&#xff0c;文件上传 …...

pgsql:还原数据库后出现重复序列导致“more than one owned sequence found“报错问题的解决

问题&#xff1a; pgsql数据库通过备份数据库文件进行还原时&#xff0c;如果表中有自增序列&#xff0c;还原后可能会出现重复的序列&#xff0c;此时若向表中插入新行时会出现“more than one owned sequence found”的报错提示。 点击菜单“其它”-》“序列”&#xff0c;…...

【PX4飞控】mavros gps相关话题分析,经纬度海拔获取方法,卫星数锁定状态获取方法

使用 ROS1-Noetic 和 mavros v1.20.1&#xff0c; 携带经纬度海拔的话题主要有三个&#xff1a; /mavros/global_position/raw/fix/mavros/gpsstatus/gps1/raw/mavros/global_position/global 查看 mavros 源码&#xff0c;来分析他们的发布过程。发现前两个话题都对应了同一…...

Yii2项目自动向GitLab上报Bug

Yii2 项目自动上报Bug 原理 yii2在程序报错时, 会执行指定action, 通过重写ErrorAction, 实现Bug自动提交至GitLab的issue 步骤 配置SiteController中的actions方法 public function actions(){return [error > [class > app\helpers\web\ErrorAction,],];}重写Error…...