vault backup: 2026-01-05 13:03:55
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
CATALINA_OPTS:
|
||||
|
||||
```bash
|
||||
export JAVA_HOME="/Users/windy/.sdkman/candidates/java/8.0.292-zulu"
|
||||
export JAVA_OPTS="-server"
|
||||
export CATALINA_OPTS="-Dwebconsole.type=properties -Dwebconsole.jms.url=tcp://localhost:61618?wireFormat.maxInactivityDuration=0 -Dwebconsole.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi -Dwebconsole.jmx.role=admin -Dwebconsole.jmx.password=pass -Dactivemq.base=/Users/windy/Projects/airport/changde/apache-tomcat-7.0.30-ciims"
|
||||
|
||||
export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote
|
||||
-Dcom.sun.management.jmxremote.port=1099
|
||||
-Dcom.sun.management.jmxremote.ssl=false
|
||||
-Dcom.sun.management.jmxremote.authenticate=false"
|
||||
```
|
||||
|
||||
|
||||
activemq.xml:
|
||||
```xml
|
||||
<broker xmlns="http://activemq.org/config/1.0" brokerName="localhost" dataDirectory="${catalina.base}/data" persistent="true" useShutdownHook="false">
|
||||
|
||||
<transportConnectors>
|
||||
<transportConnector name="openwire" uri="tcp://localhost:61618" />
|
||||
</transportConnectors>
|
||||
<managementContext>
|
||||
<managementContext jmxDomainName="org.apache.activemq" createConnector="true" connectorPort="1199" connectorPath="/jmxrmi"/>
|
||||
</managementContext>
|
||||
|
||||
```
|
||||
@@ -0,0 +1,163 @@
|
||||
|
||||
|
||||
# elastic search
|
||||
index stats:
|
||||
GET /<index_name>/_stats/store
|
||||
|
||||
cluster stats:
|
||||
GET /_cluster/stats?human&pretty
|
||||
|
||||
get index:
|
||||
GET /_cat/indices?v&s=store.size:desc
|
||||
|
||||
|
||||
---
|
||||
|
||||
### **仅通过 SSH 服务端设置超时(方案一)**
|
||||
|
||||
#### **步骤说明**:
|
||||
1. **修改 SSH 服务端配置文件**:
|
||||
```bash
|
||||
sudo vim /etc/ssh/sshd_config
|
||||
```
|
||||
|
||||
2. **添加或修改以下参数**:
|
||||
```ini
|
||||
# 客户端空闲超时设置(单位:秒)
|
||||
ClientAliveInterval 300 # 每 300 秒(5分钟)检查一次客户端是否存活
|
||||
ClientAliveCountMax 0 # 如果客户端无响应,立即断开连接(总超时时间 = 300秒=5分钟)
|
||||
```
|
||||
**或**
|
||||
```ini
|
||||
ClientAliveInterval 600 # 每 600 秒(10分钟)检查一次
|
||||
ClientAliveCountMax 3 # 允许3次无响应(总超时时间 = 600x3=1800秒=30分钟)
|
||||
```
|
||||
|
||||
3. **重启 SSH 服务**:
|
||||
```bash
|
||||
# 大多数现代系统(Ubuntu/CentOS/RHEL等):
|
||||
sudo systemctl restart sshd
|
||||
|
||||
# 旧版系统(如Debian 7):
|
||||
sudo service ssh restart
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **参数解释**:
|
||||
- `ClientAliveInterval`:
|
||||
服务器每隔 N 秒向客户端发送一次保活信号,若客户端无响应,触发超时计数。
|
||||
**示例**:`300` 表示每5分钟检查一次。
|
||||
|
||||
- `ClientAliveCountMax`:
|
||||
允许客户端连续无响应的次数,超过后断开连接。
|
||||
**示例**:
|
||||
- 若设为 `0`,客户端一次无响应立即断开(总超时时间 = `ClientAliveInterval` 值)。
|
||||
- 若设为 `3`,总超时时间 = `ClientAliveInterval × 3`。
|
||||
|
||||
---
|
||||
|
||||
### **验证配置**:
|
||||
1. **检查配置文件**:
|
||||
```bash
|
||||
grep ClientAlive /etc/ssh/sshd_config
|
||||
```
|
||||
输出应包含你设置的参数值。
|
||||
|
||||
2. **测试超时**:
|
||||
登录 SSH 后保持会话空闲,观察是否在预期时间内自动断开。
|
||||
|
||||
---
|
||||
|
||||
### **注意事项**:
|
||||
1. **优先级**:服务端配置对所有通过 SSH 登录的用户生效,覆盖客户端设置。
|
||||
2. **安全建议**:
|
||||
- 生产环境建议设置 `ClientAliveInterval=300` + `ClientAliveCountMax=0`(严格超时5分钟)。
|
||||
- 避免设置过长的超时(如几小时),以防会话被恶意利用。
|
||||
3. **备份配置**:
|
||||
修改前建议备份原文件:
|
||||
```bash
|
||||
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **总结**
|
||||
通过服务端配置 `ClientAliveInterval` 和 `ClientAliveCountMax`,即可强制所有 SSH 会话在空闲超时后自动断开,无需用户端额外操作。
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
以下是设置Linux用户密码策略的**极简步骤**:
|
||||
|
||||
---
|
||||
|
||||
### **1. 设置密码有效期**
|
||||
- **新用户**:修改全局配置
|
||||
```bash
|
||||
sudo vim /etc/login.defs
|
||||
```
|
||||
修改以下值:
|
||||
```ini
|
||||
PASS_MAX_DAYS 90 # 密码90天后过期
|
||||
PASS_MIN_DAYS 7 # 修改密码后至少7天才能再改
|
||||
PASS_WARN_AGE 14 # 过期前14天提醒
|
||||
```
|
||||
|
||||
- **现有用户**:使用 `chage` 命令
|
||||
```bash
|
||||
sudo chage -M 90 -m 7 -W 14 用户名
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **2. 设置密码复杂度**
|
||||
- 编辑PAM配置文件(Ubuntu为例):
|
||||
```bash
|
||||
sudo vim /etc/pam.d/common-password
|
||||
```
|
||||
- 修改以下行:
|
||||
```ini
|
||||
password requisite pam_pwquality.so minlen=12 difok=3 ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1
|
||||
```
|
||||
参数说明:
|
||||
- `minlen=12`:密码至少12位
|
||||
- `ucredit=-1`:需1个大写字母
|
||||
- `lcredit=-1`:需1个小写字母
|
||||
- `dcredit=-1`:需1个数字
|
||||
- `ocredit=-1`:需1个特殊符号
|
||||
|
||||
---
|
||||
|
||||
### **3. 禁止重复使用旧密码**
|
||||
在PAM配置文件中添加:
|
||||
```ini
|
||||
password required pam_unix.so remember=5 # 禁止使用最近5次用过的密码
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **4. 强制用户立即修改密码**
|
||||
```bash
|
||||
sudo chage -d 0 用户名 # 用户下次登录时必须改密码
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **5. 验证配置**
|
||||
```bash
|
||||
sudo chage -l 用户名 # 查看用户的密码策略
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **总结**
|
||||
1. 修改 `/etc/login.defs` 设置全局策略
|
||||
2. 用 `chage` 调整现有用户
|
||||
3. 通过PAM配置密码复杂度和历史
|
||||
4. 强制关键用户立即更新密码
|
||||
|
||||
完成后,用户密码会定期过期并满足复杂度要求。
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
program note:
|
||||
springboot version: 1.5.17.RELEASE
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
|
||||
## Server
|
||||
|
||||
| server name | ip address | components |
|
||||
| ----------------------- | -------------- | ------------------- |
|
||||
| hz015.int.it2000.com.cn | 10.100.100.181 | docker swarm leader |
|
||||
| hz016.int.it2000.com.cn | 10.100.100.182 | docker swarm worker |
|
||||
| hz018.int.it2000.com.cn | 10.100.100.184 | database |
|
||||
|
||||
|
||||
## Component
|
||||
- 基础设施
|
||||
- 数据库
|
||||
- oracle
|
||||
- mysql
|
||||
- redis
|
||||
- elastic search
|
||||
- 消息服务
|
||||
- apache zookeeper
|
||||
- apache kafka
|
||||
- 应用程序注册
|
||||
- eureka
|
||||
- 网关
|
||||
- spring cloud
|
||||
- 监控服务
|
||||
- 日志集中
|
||||
- logstash
|
||||
- grafana
|
||||
- promethues
|
||||
- 管理工具
|
||||
- portainer
|
||||
- kafka
|
||||
- 应用程序
|
||||
- adminapi - 管理接口
|
||||
- kafkawsproxyapi - kafka消息websocket代理
|
||||
- msgexchangeapi - 消息处理
|
||||
- servicecenter - eureka消息注册
|
||||
- sysapi
|
||||
|
||||
## Deployment
|
||||
|
||||
### App Stack
|
||||
[local git](https://gitea.int.it2000.com.cn/cdia/app-stack)
|
||||
|
||||
- adminapi (管理程序)
|
||||
2 个数据库配置,一个mysql, 一个oracle
|
||||
|
||||
```yaml
|
||||
spring:
|
||||
jpa:
|
||||
show-sql: true
|
||||
datasource:
|
||||
primary:
|
||||
username: root
|
||||
password: admingzzn
|
||||
url: >-
|
||||
jdbc:mysql://hz018.int.it2000.com.cn:3306/cdairport?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&autoReconnect=true
|
||||
max-active: 30
|
||||
test-on-borrow: true
|
||||
validation-query: SELECT 1
|
||||
initialSize: 5
|
||||
min-idle: 1
|
||||
max-wait: 60000
|
||||
time-between-eviction-runs-millis: 60000
|
||||
min-evictable-idle-time-millis: 300000
|
||||
test-while-idle: true
|
||||
test-on-return: true
|
||||
pool-prepared-statements: false
|
||||
max-pool-prepared-statement-per-connection-size: 20
|
||||
secondary:
|
||||
username: omms
|
||||
password: omms
|
||||
url: 'jdbc:oracle:thin:@hz018.int.it2000.com.cn:1521/orcl'
|
||||
driver: oracle.jdbc.driver.OracleDriver
|
||||
max-active: 30
|
||||
test-on-borrow: true
|
||||
validation-query: SELECT 1 FROM dual
|
||||
initial-size: 10
|
||||
min-idle: 1
|
||||
max-wait: 60000
|
||||
time-between-eviction-runs-millis: 60000
|
||||
min-evictable-idle-time-millis: 300000
|
||||
test-while-idle: true
|
||||
test-on-return: true
|
||||
pool-prepared-statements: false
|
||||
max-pool-prepared-statement-per-connection-size: 20
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: 'http://hz015.int.it2000.com.cn:94/eureka/'
|
||||
instance:
|
||||
prefer-ip-address: false
|
||||
hostName: adminapi
|
||||
sysApi:
|
||||
host: hz015.int.it2000.com.cn
|
||||
port: 80
|
||||
schema: http
|
||||
baseUrl: '${sysApi.schema}://SYSAPI'
|
||||
getOpLogSwitchByLevleAndNameUrl: '${sysApi.baseUrl}/oplog/getOpLogSwitch/{level}/{name}'
|
||||
logstash:
|
||||
host: 'hz015.int.it2000.com.cn:5000'
|
||||
elasticsearch:
|
||||
ip: hz016.int.it2000.com.cn
|
||||
port: 9300
|
||||
pool: 5
|
||||
cluster:
|
||||
name: docker-cluster
|
||||
nodes: 'hz016.int.it2000.com.cn:9300'
|
||||
maxSize: 10000
|
||||
|
||||
```
|
||||
|
||||
gatewayapi (api gateway)
|
||||
|
||||
```yaml
|
||||
spring:
|
||||
application:
|
||||
name: gatewayapi
|
||||
redis:
|
||||
cluster:
|
||||
nodes:
|
||||
- 'hz018.int.it2000.com.cn:7000'
|
||||
- 'hz018.int.it2000.com.cn:7001'
|
||||
- 'hz018.int.it2000.com.cn:7002'
|
||||
- 'hz018.int.it2000.com.cn:7003'
|
||||
- 'hz018.int.it2000.com.cn:7004'
|
||||
- 'hz018.int.it2000.com.cn:7005'
|
||||
pool:
|
||||
max-idle: 10
|
||||
min-idle: 0
|
||||
max-active: 200
|
||||
max-wait: -1
|
||||
timeout: 1000
|
||||
cloud:
|
||||
gateway:
|
||||
default-filters:
|
||||
- PermissionCheckFilter
|
||||
routes:
|
||||
- id: host_adminapi
|
||||
uri: 'lb://ADMINAPI'
|
||||
predicates:
|
||||
- Path=/adminapi/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
- id: host_sysapi
|
||||
uri: 'lb://SYSAPI'
|
||||
predicates:
|
||||
- Path=/sysapi/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
- id: host_msgexchangeapi
|
||||
uri: 'lb://MSGEXCHANGEAPI'
|
||||
predicates:
|
||||
- Path=/msgexchangeapi/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
- id: host_kafkawsproxyapi
|
||||
uri: 'lb://KAFKAWSPROXYAPI'
|
||||
predicates:
|
||||
- Path=/v2/broker
|
||||
- id: host_adminweb
|
||||
uri: 'http://10.100.100.181:96'
|
||||
predicates:
|
||||
- Path=/adminweb/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
- id: host_redirect
|
||||
uri: 'http://10.100.100.181/adminweb/'
|
||||
predicates:
|
||||
- Path=/
|
||||
filters:
|
||||
- 'RedirectTo=302, http://10.100.100.181/adminweb/'
|
||||
gateway:
|
||||
loginUrl: '/adminweb/#/login'
|
||||
sysApi:
|
||||
schema: http
|
||||
baseUrl: '${sysApi.schema}://SYSAPI'
|
||||
getUserByLoginName: '${sysApi.baseUrl}/setting/user/detail/{loginName}'
|
||||
publicurlsServiceUrl: '${sysApi.baseUrl}/setting/permission/publicurls'
|
||||
privateurlsServiceUrl: '${sysApi.baseUrl}/setting/permission/privateurls/{uid}'
|
||||
getOpLogSwitchByLevleAndNameUrl: '${sysApi.baseUrl}/oplog/getOpLogSwitch/{level}/{name}'
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: 'http://hz015.int.it2000.com.cn:94/eureka/'
|
||||
instance:
|
||||
prefer-ip-address: false
|
||||
hostName: gatewayapi
|
||||
logstash:
|
||||
host: 'hz015.int.it2000.com.cn:5000'
|
||||
elasticsearch:
|
||||
ip: hz016.int.it2000.com.cn
|
||||
port: 9300
|
||||
pool: 5
|
||||
password: changeme
|
||||
username: elastic
|
||||
cluster:
|
||||
name: docker-cluster
|
||||
nodes: 'hz016.int.it2000.com.cn:9300'
|
||||
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
## 基础设施
|
||||
* 日志服务
|
||||
* 使用graylog 代替elk
|
||||
hz011.int.it2000.com.cn
|
||||
130.120.3.128
|
||||
http://hz011.int.it2000.com.cn:9000
|
||||
admin/admingzzn
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
主机名:xjc-app
|
||||
账号:devman
|
||||
登录方式:密钥id_devman
|
||||
账号密码:Ipower2024
|
||||
IP:10.100.101.186(动态IP)
|
||||
|
||||
```id_devman
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||
QyNTUxOQAAACBIahgzOtvIiFs9sYakfuvDBVDyWTOpJ2mFJ9UHKTWPOwAAAJCr8Cxoq/As
|
||||
aAAAAAtzc2gtZWQyNTUxOQAAACBIahgzOtvIiFs9sYakfuvDBVDyWTOpJ2mFJ9UHKTWPOw
|
||||
AAAEBBdD+wjI107ItWAvtejiFNF9fpXXn4kj9PKyzEguRwEkhqGDM628iIWz2xhqR+68MF
|
||||
UPJZM6knaYUn1QcpNY87AAAAC2Rldm1hbkBnenpuAQI=
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
```
|
||||
|
||||
```
|
||||
Host xjc-app
|
||||
User devman
|
||||
IdentityFile ~/.ssh/id_devman
|
||||
```
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,584 @@
|
||||
|
||||
|
||||
# 技术选型
|
||||
### 串口数据接收
|
||||
1. 串口模拟器
|
||||
1. socat
|
||||
1. **Create Virtual Serial Port Pair** Use `socat` to create two linked virtual serial ports. This example creates two virtual serial ports: `/dev/ttyV0` and `/dev/ttyV1`.
|
||||
```bash
|
||||
socat -d -d PTY,link=./dev/ttyV0,raw,echo=0 PTY,link=./dev/ttyV1,raw,echo=0
|
||||
```
|
||||
**Explanation:**
|
||||
- `-d -d`: Enables debug output to see the details of the operations.
|
||||
- `PTY,link=/dev/ttyV0,raw,echo=0`: Creates a pseudo-terminal (PTY) with a symbolic link `/dev/ttyV0`, in raw mode with no echo.
|
||||
- `PTY,link=/dev/ttyV1,raw,echo=0`: Creates another PTY with a symbolic link `/dev/ttyV1`, in raw mode with no echo.
|
||||
-
|
||||
```bash
|
||||
screen ./dev/ttyV0 9600
|
||||
|
||||
echo "hello" > ./dev/ttyV1
|
||||
```
|
||||
### 消息队列
|
||||
nats-server
|
||||
|
||||
|
||||
# 架构设计
|
||||
|
||||
micrioprofile
|
||||
openliberty
|
||||
|
||||
|
||||
micronaut
|
||||
|
||||
|
||||
1. 串口读取
|
||||
2. 报文拆分
|
||||
3. 动态解析
|
||||
4. 计划解析
|
||||
5. 总线消息生成
|
||||
6. 动态信息转发
|
||||
7. 计划转发
|
||||
|
||||
串口 => 消息流原始 => 已分离电报消息 => 待发送 => 消息总线
|
||||
|
||||
### 系统总线适配
|
||||
日计划处理
|
||||
季度计划处理
|
||||
航班主要信息同步
|
||||
动态消息转发
|
||||
### 串口转消息队列
|
||||
命令行工具
|
||||
1. 串口参数
|
||||
2. 消息队列参数
|
||||
|
||||
### 电报存储
|
||||
postgresql
|
||||
pocketbase
|
||||
|
||||
nats
|
||||
nui
|
||||
pocketbase
|
||||
meilisearch
|
||||
|
||||
compose.yml
|
||||
```yaml
|
||||
services:
|
||||
nats:
|
||||
container_name: nats
|
||||
image: nats
|
||||
ports:
|
||||
- "4222:4222"
|
||||
- "6222:6222"
|
||||
- "8222:8222"
|
||||
restart: unless-stopped
|
||||
|
||||
nui:
|
||||
container_name: nui
|
||||
image: ghcr.io/nats-nui/nui
|
||||
volumes:
|
||||
- ./db:/db
|
||||
- ./creds:/nats-creds:ro
|
||||
ports:
|
||||
- "31311:31311"
|
||||
restart: unless-stopped
|
||||
|
||||
pocketbase:
|
||||
image: ghcr.io/muchobien/pocketbase:latest
|
||||
container_name: pocketbase
|
||||
restart: unless-stopped
|
||||
command:
|
||||
#- --encryptionEnv #optional
|
||||
#- ENCRYPTION #optional
|
||||
environment:
|
||||
ENCRYPTION: example #optional
|
||||
ports:
|
||||
- "8090:8090"
|
||||
volumes:
|
||||
- ./data:/pb_data
|
||||
- ./public:/pb_public #optional
|
||||
- ./hooks:/pb_hooks #optional
|
||||
|
||||
healthcheck: #optional (recommended) since v0.10.0
|
||||
test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
meilisearch:
|
||||
container_name: meilisearch
|
||||
image: getmeili/meilisearch:v1.8
|
||||
environment:
|
||||
- http_proxy
|
||||
- https_proxy
|
||||
- MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-masterKey}
|
||||
- MEILI_NO_ANALYTICS=${MEILI_NO_ANALYTICS:-true}
|
||||
- MEILI_ENV=${MEILI_ENV:-development}
|
||||
ports:
|
||||
- ${MEILI_PORT:-7700}:7700
|
||||
volumes:
|
||||
- ./meili_data:/meili_data
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
|
||||
nat with monitor:
|
||||
```docker-compose.yml
|
||||
networks:
|
||||
monitor-net:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
nats:
|
||||
image: nats
|
||||
container_name: nats
|
||||
restart: always
|
||||
command: -c /etc/nats/nats.conf
|
||||
ports:
|
||||
- "4222:4222" # client port
|
||||
- "6222:6222" # cluster port
|
||||
- "8222:8222" # monitoring port
|
||||
volumes:
|
||||
- ./nats.conf:/etc/nats/nats.conf
|
||||
- $JETSTREAM_STORAGE:/data
|
||||
networks:
|
||||
- monitor-net
|
||||
|
||||
exporter:
|
||||
image: natsio/prometheus-nats-exporter
|
||||
container_name: nats-exporter
|
||||
restart: always
|
||||
command:
|
||||
# see https://github.com/nats-io/prometheus-nats-exporter/blob/main/main.go#L87
|
||||
# "-connz", # connection metrics
|
||||
- -connz_detailed # advanced connection metrics
|
||||
- -jsz
|
||||
- all # jetstream metrics
|
||||
- -routez # route metrics
|
||||
- -subz # subscription metrics
|
||||
- -varz # general metrics
|
||||
- -prefix=nats # prefix for all metrics
|
||||
- -use_internal_server_id # using serverID from /varz
|
||||
- http://nats:8222/
|
||||
networks:
|
||||
- monitor-net
|
||||
labels:
|
||||
org.label-schema.group: "nats-monitoring"
|
||||
depends_on:
|
||||
- nats
|
||||
|
||||
# ports:
|
||||
# - "7777:7777"
|
||||
|
||||
surveyor:
|
||||
image: natsio/nats-surveyor
|
||||
container_name: nats-surveyor
|
||||
restart: always
|
||||
volumes:
|
||||
- ./observations:/observations
|
||||
- $JETSTREAM_STORAGE:/data
|
||||
command: |
|
||||
-s "${NATS_SURVEYOR_SERVERS}" --accounts --observe /observations --jetstream /data
|
||||
networks:
|
||||
- monitor-net
|
||||
labels:
|
||||
org.label-schema.group: "nats-monitoring"
|
||||
depends_on:
|
||||
- nats
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
container_name: prometheus
|
||||
restart: always
|
||||
volumes:
|
||||
- ./prometheus/:/etc/prometheus/
|
||||
- $PROMETHEUS_STORAGE:/usr/local/share/prometheus
|
||||
command: --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/usr/local/share/prometheus
|
||||
networks:
|
||||
- monitor-net
|
||||
labels:
|
||||
org.label-schema.group: "nats-monitoring"
|
||||
ports:
|
||||
- "9090:9090"
|
||||
depends_on:
|
||||
- surveyor
|
||||
- exporter
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana
|
||||
container_name: grafana
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./grafana/dashboards:/var/lib/grafana/dashboards
|
||||
- ./grafana/provisioning:/etc/grafana/provisioning
|
||||
networks:
|
||||
- monitor-net
|
||||
labels:
|
||||
org.label-schema.group: "nats-monitoring"
|
||||
depends_on:
|
||||
- prometheus
|
||||
```
|
||||
|
||||
```dash
|
||||
```
|
||||
|
||||
### 电报解析,电报存储,电报转发
|
||||
管理界面接口
|
||||
|
||||
### 管理界面
|
||||
电报界面
|
||||
日计划界面
|
||||
全文检索
|
||||
typesense
|
||||
meli
|
||||
|
||||
nextjs shadcn
|
||||
svelte
|
||||
shadcn
|
||||
melt-ui: https://melt-ui.com
|
||||
flowbite: [Flowbite Svelte](https://flowbite-svelte.com/)
|
||||
|
||||
htmx:
|
||||
go:
|
||||
chi htmx tailwindcss
|
||||
echo htmx tailwindcss
|
||||
python:
|
||||
|
||||
deno:
|
||||
fresh
|
||||
|
||||
|
||||
Telegram Message Body Expression:
|
||||
|
||||
FPL:
|
||||
```regex
|
||||
|
||||
\((?P<category>[A-Z]{3})-(?P<number>[A-Z]+\d+)-(?P<indicator>[A-Z]{2})\n-(?P<aircraft>[A-Z]+\d+\/?[A-Z]?)\n?-(?P<surve>.*)\n?-(?P<departure>[A-Z]{4})(?P<departure_time>\d{4})\n?-(?P<speed>[A-Z]+\d+)(?P<level>[A-Z0-9]+)\s+(?P<route>(.|\n)+)\n-(?P<destination>[A-Z]{4})(?P<estt>\d{4})\s+(?P<alter>[A-Z]{4})\n?-([A-Z]{3}\/(?:[A-Z]{4}\d{4}\s?)+)?(?P<other>(?m)[A-Z]{3}\/(.|\n)*)\)$
|
||||
|
||||
```
|
||||
|
||||
ARR:
|
||||
```regex
|
||||
|
||||
\\((?P<type>[A-Z]{3})\\-(?P<number>([A-Z]+\\d+))\\/?(?P<ssr>[A-Z]+\\d+)\\-(?P<departure>[A-Z]{4})\\-(?P<arrival>[A-Z]{4})(?P<time>\\d{4})\\)
|
||||
|
||||
```
|
||||
|
||||
DEP:
|
||||
```regex
|
||||
|
||||
^\\((?P<type>[A-Z]{3})\\-(?P<number>([A-Z]+\\d+))\\/?(?P<ssr>[A-Z]+\\d+)\\-(?P<departure>[A-Z]{4})(?P<departure_time>\\d{4})\\-(?P<destination>[A-Z]{4})(?P<destination_time>\\d{4})?\\-?(?P<alter>[A-Z]{4})?\\-?(?P<other>.*)?\\)$
|
||||
```
|
||||
|
||||
NEW FPL:
|
||||
```regex
|
||||
\((?P<category>[A-Z]{3})-(?P<number>[A-Z]+\d+)-(?P<indicator>[A-Z]{2})\n-(?P<aircraft>[A-Z]+\d+\/?[A-Z]?)\n?-(?P<surve>.*)\n?-(?P<departure>[A-Z]{4})(?P<departure_time>\d{4})\n?-(?P<speed>[A-Z]+\d+)(?P<level>[A-Z0-9]+)\s+(?P<route>(.|\n)+)\n-(?P<destination>[A-Z]{4})(?P<estt>\d{4})\s?(?P<alter>(\s[A-Z]{4})+)\n?-([A-Z]{3}\/(?:[A-Z]{4}\d{4}\s?)+)?(?P<other>(?m)[A-Z]{3}\/(.|\n)*)\)$
|
||||
```
|
||||
|
||||
CNL:
|
||||
```regex
|
||||
^\((?P<category>[A-Z]{3})-(?P<number>\w+\d+)-?(?P<departure>[A-Z]{4})?-?(?<destination>[A-Z]{4})\)$
|
||||
```
|
||||
|
||||
DLA:
|
||||
```regex
|
||||
^\((?P<category>[A-Z]{3})-(?P<number>\w+\d+)-?(?P<departure>[A-Z]{4})(?P<departure_time>\d{4})?-?(?<destination>[A-Z]{4})(?<destination_time>\d{4})?\)$
|
||||
```
|
||||
|
||||
|
||||
|
||||
```CA
|
||||
ZCZC TMQ1067 150518
|
||||
|
||||
|
||||
QU TSNZPCA
|
||||
|
||||
.
|
||||
|
||||
QU SZXZPCA TAOZPCA WNZZPCA SHATZCR PEKZPCA WUHZPCA TSNZPCA
|
||||
|
||||
.TNAUOSC 150519
|
||||
|
||||
PLN 16MAY
|
||||
|
||||
01) SC4731/4732/4667/4668 B2968/B733 ILS I (7) TAO/2340 WNZ/0225
|
||||
|
||||
SZX/
|
||||
|
||||
0500 WNZ/0725 TAO/1000 SHA/1210
|
||||
|
||||
SI:AWY/TAO WNZ SZX WNZ TAO SHA TAO
|
||||
|
||||
02) SC4617/4618/4655/4656/4087/4088/4669/4670 B2996/B733 ILS I (8)
|
||||
|
||||
TA
|
||||
|
||||
O/0030 WUH/0255 TAO/0520 PEK/0730 TAO/0945 ICN/1155 TAO/1350
|
||||
|
||||
SHA/1550
|
||||
|
||||
SI:AWY/TAO WUH TAO PEK TAO ICN TAO SHA TAO
|
||||
|
||||
03) SC4621/4622/4733/4734 B3005/CRJ2 ILS I (5) TAO/0005 DLC/0130
|
||||
|
||||
TAO/
|
||||
|
||||
0300 XIY/0545 KWE/0745 XIY/0950
|
||||
|
||||
SI:AWY/TAO DLC TAO XIY KWE XIY TAO
|
||||
|
||||
04) SC4607/4608/4623/4880/4879/4624 B3007/CRJ2 ILS I (5) TAO/2355
|
||||
|
||||
TY
|
||||
|
||||
N/0150 ZGC/0350 TYN/0545 TAO/0745 DLC/0900 YNT/1015 HGH/1225
|
||||
|
||||
YNT/1435 DLC
|
||||
|
||||
/1550
|
||||
|
||||
SI:AWY/TAO TYN ZGC TYN TAO DLC YNT HGH YNT DLC TAO
|
||||
|
||||
05) SC4679/4680/4711/4712 B3079/CRJ7 ILS I (5) TAO/0001 HGH/0210
|
||||
|
||||
FOC/
|
||||
|
||||
0350 HGH/0530 TAO/0735 HGH/0940 NNG/1255 HGH/1525
|
||||
|
||||
SI:AWY/TAO HGH FOC HGH TAO HGH NNG HGH TAO
|
||||
|
||||
06) SC4717/4817/4818/4718 B3080/CRJ7 ILS I (5) TAO/0005 TSN/0135
|
||||
|
||||
HET/
|
||||
|
||||
0320 TGO/0535 HET/0750 TSN/0930
|
||||
|
||||
SI:AWY/TAO TSN HET TGO HET TSN TAO
|
||||
|
||||
07) SC4709/4981/4982 B5065/B733 ILS I (7) TAO/2355 NGB/0155
|
||||
|
||||
XMN/0430
|
||||
|
||||
TNA/0725 HET/0950 TNA/1200
|
||||
|
||||
SI:AWY/TAO NGB XMN TNA HET TNA XMN
|
||||
|
||||
08) SC4651/1152/1155/1156/1165/1166/1167/1168 B5205/B737 ILS I (7)
|
||||
|
||||
TA
|
||||
|
||||
O/2340 PEK/0140 TNA/0320 PEK/0510 TNA/0715 SHA/0925 TNA/1135
|
||||
|
||||
SHA/1340
|
||||
|
||||
SI:AWY/TAO PEK TNA PEK TNA SHA TNA SHA TNA
|
||||
|
||||
09) SC4695/4696/4657/4658 B5331/B738 ILS I (8) TAO/2350 NKG/0145
|
||||
|
||||
KMG/
|
||||
|
||||
0505 NKG/0830 TAO/1045 PEK/1300
|
||||
|
||||
SI:AWY/TAO NKG KMG NKG TAO PEK TAO
|
||||
|
||||
10) SC4601/4602/4675/4672 B5348/B738 ILS I (10) TAO/2330 TNA/0055
|
||||
|
||||
CTU
|
||||
|
||||
/0405 TNA/0645 TAO/0830 CAN/1225 LYI/1515
|
||||
|
||||
SI:AWY/TAO TNA CTU TNA TAO CAN LYI TAO
|
||||
|
||||
11) SC4705/4706/4751/4752 B5349/B738 ILS I (8) TAO/2340 HFE/0135
|
||||
|
||||
HHA/
|
||||
|
||||
0335 HFE/0530 TAO/0720 CGO/0930 KWL/1210 CGO/1440
|
||||
|
||||
SI:AWY/TAO HFE HHA HFE TAO CGO KWL CGO TAO
|
||||
|
||||
12) SC4671/4676/4665/4666/4659/4660 B5350/B738 ILS I (8) TAO/2350
|
||||
|
||||
LYI
|
||||
|
||||
/0105 CAN/0415 TAO/0745 SHA/0950 TAO/1155 PEK/1400
|
||||
|
||||
SI:AWY/TAO LYI CAN TAO SHA TAO
|
||||
|
||||
PART ONE CONTINUED
|
||||
|
||||
=
|
||||
|
||||
|
||||
|
||||
|
||||
NNNN
|
||||
|
||||
```
|
||||
|
||||
|
||||
```fpl
|
||||
ZCZC TMQ2544 141652
|
||||
|
||||
|
||||
FF ZBTJZXZX
|
||||
|
||||
|
||||
141652 ZBTJZPZX
|
||||
|
||||
|
||||
(FPL-JAE7433-IS
|
||||
|
||||
|
||||
-B744/H-SXIRPZJWY/S
|
||||
|
||||
|
||||
-ZBTJ1755
|
||||
|
||||
|
||||
-K0926S0920
|
||||
|
||||
|
||||
-EDDF0948 EDDK
|
||||
|
||||
|
||||
-EET/ZMUB0100 UNKL0236 UNWW0332 UNNT0332 USRR0447 USHH0507
|
||||
|
||||
|
||||
USSS0535 UUYY0602 ULKK0634 ULWW0653 ULLL0720 EETT0748 EVRR0815
|
||||
|
||||
|
||||
ESAA0821 EPWW0848 EDUU0900
|
||||
|
||||
|
||||
REG/B2422 SEL/JLAD OPR/JADE CARGO DAT/S RVR/200
|
||||
|
||||
|
||||
NAV/RNAV1 RNAV5 RNP4
|
||||
|
||||
|
||||
RMK/AGCS EQUIPPED
|
||||
|
||||
|
||||
ACARS EQUIPPED/TCAS EQUIPPED/FOREIGN PILOT
|
||||
|
||||
|
||||
E/1148 P/TBN R/UV S/M J/LF D/1 15 C YELLOW
|
||||
|
||||
|
||||
A/WHITE GREEN)
|
||||
|
||||
NNNN
|
||||
|
||||
```
|
||||
|
||||
|
||||
计划:
|
||||
|
||||
airway:
|
||||
```regex
|
||||
(?P<arr_time>\d{4}(\(\d{2}\w{3}\))?)(?P<airport>\w{3})\/?(?P<dep_time>\d{4}(\(\d{2}\w{3}\))?)
|
||||
```
|
||||
|
||||
|
||||
## Store
|
||||
|
||||
nats:
|
||||
serial to nats
|
||||
```yaml
|
||||
services:
|
||||
nats:
|
||||
container_name: nats
|
||||
image: nats
|
||||
ports:
|
||||
- "4222:4222"
|
||||
- "6222:6222"
|
||||
- "8222:8222"
|
||||
restart: unless-stopped
|
||||
|
||||
nui:
|
||||
container_name: nui
|
||||
image: ghcr.io/nats-nui/nui
|
||||
volumes:
|
||||
- ./db:/db
|
||||
- ./creds:/nats-creds:ro
|
||||
ports:
|
||||
- "31311:31311"
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
|
||||
|
||||
python:
|
||||
```
|
||||
|
||||
f:\D\DEV\lang\python3.13\python.exe -m site
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
nats browser websocket client
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>NATS WebSocket Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>NATS WebSocket Example</h1>
|
||||
|
||||
<!-- A button to send a message -->
|
||||
<button id="sendMessageBtn">Send Message</button>
|
||||
|
||||
<!-- An area to display received messages -->
|
||||
<pre id="messages"></pre>
|
||||
|
||||
<!-- Use a JavaScript module to import the NATS WebSocket client -->
|
||||
<script type="module">
|
||||
// Import the NATS WebSocket client from a CDN (Skypack is used as an example)
|
||||
import { connect, StringCodec } from "https://cdn.skypack.dev/nats.ws";
|
||||
|
||||
// A simple string codec for encoding/decoding message data
|
||||
const sc = StringCodec();
|
||||
|
||||
async function runNATS() {
|
||||
try {
|
||||
// Connect to the NATS WebSocket server (adjust URL as needed)
|
||||
const nc = await connect({ servers: "ws://fzq-pc:7070" });
|
||||
|
||||
// Subscribe to a subject (e.g., "mySubject") to receive messages
|
||||
const sub = nc.subscribe("Telegram.Serial");
|
||||
(async () => {
|
||||
for await (const msg of sub) {
|
||||
const messageText = sc.decode(msg.data);
|
||||
document.getElementById("messages").textContent +=
|
||||
`\nReceived: ${messageText}`;
|
||||
}
|
||||
})().then(() => {
|
||||
console.log("Subscription closed");
|
||||
});
|
||||
|
||||
// Bind our "Send Message" button to publish messages
|
||||
document
|
||||
.getElementById("sendMessageBtn")
|
||||
.addEventListener("click", () => {
|
||||
const payload = "Hello from the browser!";
|
||||
nc.publish("mySubject", sc.encode(payload));
|
||||
document.getElementById("messages").textContent +=
|
||||
`\nSent: ${payload}`;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("Error connecting to NATS:", err);
|
||||
}
|
||||
}
|
||||
|
||||
// Start the NATS connection on page load
|
||||
runNATS();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
```
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
|
||||
| 电报组成 |
|
||||
| ------ |
|
||||
| (脉冲信号) |
|
||||
| 报头 |
|
||||
| 收报地址 |
|
||||
| 发报地址 |
|
||||
| 报文内容 |
|
||||
| 报尾 |
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
install
|
||||
```yaml
|
||||
services:
|
||||
meilisearch:
|
||||
container_name: meilisearch
|
||||
image: getmeili/meilisearch:v1.8
|
||||
environment:
|
||||
- MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-W8mBr4_a5CfQgk9tbAHbGz1YF71t7_GT7fD1hp7prOY}
|
||||
ports:
|
||||
- ${MEILI_PORT:-7700}:7700
|
||||
networks:
|
||||
- meilisearch
|
||||
volumes:
|
||||
- ./meili_data:/meili_data
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
meilisearch:
|
||||
driver: bridge
|
||||
```
|
||||
|
||||
master key:
|
||||
```text
|
||||
W8mBr4_a5CfQgk9tbAHbGz1YF71t7_GT7fD1hp7prOY
|
||||
```
|
||||
|
||||
```bash
|
||||
curl \
|
||||
-X POST 'http://localhost:7700/indexes/movies/documents?primaryKey=id' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer W8mBr4_a5CfQgk9tbAHbGz1YF71t7_GT7fD1hp7prOY' \
|
||||
--data-binary @movies.json
|
||||
```
|
||||
|
||||
```bash
|
||||
http POST \
|
||||
'http://localhost:7700/indexes/movies/documents?primaryKey=id' \
|
||||
Content-Type: application/json
|
||||
-A W8mBr4_a5CfQgk9tbAHbGz1YF71t7_GT7fD1hp7prOY < movies.json
|
||||
```
|
||||
@@ -0,0 +1,213 @@
|
||||
|
||||
|
||||
# Implementing XML Response Formatting in Micronaut Applications
|
||||
|
||||
Micronaut provides robust support for XML response formatting through the Jackson XML module. This report outlines how to configure your Micronaut application to return data classes formatted as XML responses.
|
||||
|
||||
## Adding Required Dependencies
|
||||
|
||||
The first step in enabling XML response formatting is adding the necessary dependency to your project. The Jackson XML support for Micronaut allows for seamless serialization and deserialization of XML for both client and server sides.
|
||||
|
||||
### Maven Configuration
|
||||
|
||||
```xml
|
||||
|
||||
io.micronaut.xml
|
||||
micronaut-jackson-xml
|
||||
|
||||
```
|
||||
|
||||
This dependency adds the Jackson XML module to your project, enabling XML conversion capabilities[1][2][5]. Once added, Micronaut will automatically create the beans necessary for XML serialization and deserialization.
|
||||
|
||||
### Gradle Configuration
|
||||
|
||||
```
|
||||
implementation("io.micronaut.xml:micronaut-jackson-xml")
|
||||
```
|
||||
|
||||
## Creating XML-Compatible Data Classes
|
||||
|
||||
After adding the dependency, you need to create data classes properly annotated for XML serialization.
|
||||
|
||||
### Java Implementation
|
||||
|
||||
```java
|
||||
package com.example;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import io.micronaut.core.annotation.Introspected;
|
||||
|
||||
@Introspected
|
||||
@JacksonXmlRootElement(localName = "person")
|
||||
public class Person {
|
||||
@JacksonXmlProperty(isAttribute = true)
|
||||
private int id;
|
||||
|
||||
@JacksonXmlProperty(localName = "fullName")
|
||||
private String name;
|
||||
|
||||
@JacksonXmlProperty
|
||||
private int age;
|
||||
|
||||
// Constructors, getters, and setters
|
||||
}
|
||||
```
|
||||
|
||||
The `@JacksonXmlRootElement` annotation defines the root element name in the XML output, while `@JacksonXmlProperty` customizes how each field is serialized[2]. The `isAttribute = true` parameter converts a field to an XML attribute rather than a nested element.
|
||||
|
||||
### Kotlin Implementation
|
||||
|
||||
```kotlin
|
||||
package com.example
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty
|
||||
import io.micronaut.core.annotation.Introspected
|
||||
|
||||
@Introspected
|
||||
@JacksonXmlRootElement(localName = "person")
|
||||
data class Person(
|
||||
@field:JacksonXmlProperty(isAttribute = true)
|
||||
val id: Int,
|
||||
|
||||
@field:JacksonXmlProperty(localName = "fullName")
|
||||
val name: String,
|
||||
|
||||
@field:JacksonXmlProperty
|
||||
val age: Int
|
||||
)
|
||||
```
|
||||
|
||||
The `@field:` prefix is important in Kotlin to apply the annotation to the underlying field rather than the property accessor[1].
|
||||
|
||||
## Implementing Controllers for XML Responses
|
||||
|
||||
There are several approaches to returning XML from your controllers:
|
||||
|
||||
### Method 1: Content Negotiation Using @Produces
|
||||
|
||||
The simplest approach is to use Micronaut's content negotiation by specifying that your endpoint can produce XML:
|
||||
|
||||
```java
|
||||
import io.micronaut.http.MediaType;
|
||||
import io.micronaut.http.annotation.Controller;
|
||||
import io.micronaut.http.annotation.Get;
|
||||
import io.micronaut.http.annotation.Produces;
|
||||
|
||||
@Controller("/api")
|
||||
public class PersonController {
|
||||
|
||||
@Get("/person/{id}")
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
|
||||
public Person getPerson(Long id) {
|
||||
return new Person(id, "John Doe", 30);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
By including `MediaType.APPLICATION_XML` in the `@Produces` annotation, Micronaut will automatically convert the returned object to XML if the client's request includes an Accept header of `application/xml`[7].
|
||||
|
||||
### Method 2: Manual Content Type Selection
|
||||
|
||||
You can also manually check the Accept header and determine the response format:
|
||||
|
||||
```java
|
||||
import io.micronaut.http.HttpHeaders;
|
||||
import io.micronaut.http.HttpResponse;
|
||||
import io.micronaut.http.MediaType;
|
||||
import io.micronaut.http.annotation.Controller;
|
||||
import io.micronaut.http.annotation.Get;
|
||||
|
||||
@Controller("/api")
|
||||
public class PersonController {
|
||||
|
||||
@Get("/person/{id}")
|
||||
public HttpResponse getPerson(Long id, HttpHeaders headers) {
|
||||
Person person = new Person(id, "John Doe", 30);
|
||||
|
||||
if (headers.accept().contains(MediaType.APPLICATION_XML_TYPE)) {
|
||||
return HttpResponse.ok(person)
|
||||
.contentType(MediaType.APPLICATION_XML_TYPE);
|
||||
}
|
||||
|
||||
return HttpResponse.ok(person);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This approach gives you more control over the response format based on the request headers[4].
|
||||
|
||||
## Handling Nested Objects
|
||||
|
||||
When working with nested objects, ensure all classes are properly annotated and instantiated:
|
||||
|
||||
```java
|
||||
@Introspected
|
||||
@JacksonXmlRootElement(localName = "settings")
|
||||
public class Settings {
|
||||
private SettingsBlock settingsBlock = new SettingsBlock(); // Initialize nested object
|
||||
private int test1 = 10;
|
||||
private int test2;
|
||||
|
||||
// Getters and setters
|
||||
}
|
||||
|
||||
@Introspected
|
||||
@JacksonXmlRootElement(localName = "settingsBlock")
|
||||
public class SettingsBlock {
|
||||
private Boolean block1 = true;
|
||||
private Boolean block2 = false;
|
||||
|
||||
// Getters and setters
|
||||
}
|
||||
```
|
||||
|
||||
Without proper initialization of nested objects, the XML output won't include their properties[3].
|
||||
|
||||
## Testing XML Responses
|
||||
|
||||
To test that your application correctly returns XML:
|
||||
|
||||
```bash
|
||||
curl -H "Accept: application/xml" http://localhost:8080/api/person/1
|
||||
```
|
||||
|
||||
This should return a response like:
|
||||
|
||||
```xml
|
||||
|
||||
John Doe
|
||||
30
|
||||
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
Implementing XML responses in Micronaut is straightforward thanks to the Jackson XML integration. By adding the appropriate dependency, annotating your data classes, and configuring your controllers, you can easily support both JSON and XML formats in your Micronaut applications.
|
||||
|
||||
For applications that need to support multiple response formats, Micronaut's content negotiation provides a clean approach, automatically selecting the appropriate format based on the client's Accept header. This flexibility makes Micronaut an excellent choice for building APIs that need to interact with diverse client requirements.
|
||||
|
||||
Citations:
|
||||
[1] https://micronaut-projects.github.io/micronaut-jackson-xml/latest/guide/
|
||||
[2] https://mkyong.com/micronaut/return-xml-in-a-micronaut-controller/
|
||||
[3] https://stackoverflow.com/questions/75351099/convert-object-to-xml-using-jackson-dataformat-xml-with-default-values/75351212
|
||||
[4] https://dzone.com/articles/micronaut-mastery-return-response-based-on-http-ac
|
||||
[5] https://guides.micronaut.io/latest/micronaut-produces-xml-maven-java.html
|
||||
[6] https://stackoverflow.com/questions/79230827/how-to-convert-xml-response-with-retrofit-to-data-classes
|
||||
[7] https://stackoverflow.com/questions/64698424/micronaut-ignores-content-type-that-a-client-accepts
|
||||
[8] https://stackoverflow.com/questions/75277353/converting-a-data-class-to-a-mappedentity-data-class-in-micronaut-using-kotlin
|
||||
[9] https://github.com/micronaut-projects/micronaut-core/issues/5907
|
||||
[10] https://guides.micronaut.io/latest/micronaut-data-jdbc-repository-maven-kotlin.html
|
||||
[11] https://github.com/apache/jmeter/issues/5980
|
||||
[12] https://micronaut-projects.github.io/micronaut-data/latest/guide/
|
||||
[13] https://stackoverflow.com/questions/79361607/xml-deserialization-in-micronaut-4-x-is-failing-when-same-pojos-work-fine-in-spr
|
||||
[14] https://github.com/micronaut-projects/micronaut-core/issues/10016
|
||||
[15] https://www.baeldung.com/kotlin/csv-files
|
||||
[16] https://guides.micronaut.io/latest/micronaut-java-records-gradle-java.html
|
||||
[17] https://docs.oracle.com/en/engineered-systems/oracle-database-appliance/19.23/cmtrx/faqs-micronaut-oracle-database-appliance.html
|
||||
[18] https://jasondl.ee/2019/micronaut-jpa-jwt-kotlin
|
||||
[19] https://github.com/micronaut-projects/micronaut-core/issues/10895
|
||||
|
||||
---
|
||||
来自 Perplexity 的回答: pplx.ai/share
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
## Dev
|
||||
|
||||
### Windows COM Simulator
|
||||
|
||||
==
|
||||
|
||||
亲!久等了哦。这就给您发过来了
|
||||
您购买的订单号:4197674126108532620
|
||||
|
||||
链接: https://pan.baidu.com/s/1BkU5_FAVzvAgRw96mBi_gw?pwd=xs2q 提取码: xs2q 复制这段内容后打开百度网盘手机App,操作更方便哦
|
||||
--来自百度网盘超级会员v10的分享
|
||||
记得再来哦~
|
||||
|
||||
==
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
export ANT_OPTS="-Dhttp.proxyHost=localhost -Dhttp.proxyPort=8080"
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
# 根据路由
|
||||
@@ -0,0 +1,161 @@
|
||||
|
||||
**Summary of the Problem and Solution**
|
||||
|
||||
---
|
||||
|
||||
### **Problem Overview**
|
||||
|
||||
You were attempting to run an Oracle 11g Docker container using the command:
|
||||
|
||||
```bash
|
||||
docker run -idt --name oracle -h oracle --privileged=true -p 1521:1521 -p 2222:22 \
|
||||
lhrbest/oracle_11g_ee_lhr_11.2.0.4:2.0 init
|
||||
```
|
||||
|
||||
- **Issue Experienced:**
|
||||
- The Docker container exited immediately after starting, without any error messages.
|
||||
- The exit code was **139**, indicating a **segmentation fault (SIGSEGV)**.
|
||||
- The issue occurred on a **Debian** system but not on **OpenSUSE**.
|
||||
|
||||
---
|
||||
|
||||
### **Root Cause**
|
||||
|
||||
The segmentation fault was due to the way modern Linux kernels handle **`vsyscall`** (virtual system call):
|
||||
|
||||
- **`vsyscall` Deprecation:**
|
||||
- Modern kernels have deprecated `vsyscall` in favor of **vDSO** (virtual dynamic shared object) for security reasons.
|
||||
- By default, `vsyscall` might be disabled or set to a mode incompatible with older applications.
|
||||
|
||||
- **Impact on Oracle 11g:**
|
||||
- Oracle 11g, being legacy software, relies on the old `vsyscall` mechanism for certain operations.
|
||||
- Without proper `vsyscall` support, Oracle binaries can crash with a segmentation fault.
|
||||
|
||||
- **Difference Between Systems:**
|
||||
- **OpenSUSE** may have `vsyscall` support enabled or set to emulate by default.
|
||||
- **Debian**, especially with newer kernels, has `vsyscall` disabled or set to a mode that doesn't support the required legacy behavior.
|
||||
|
||||
---
|
||||
|
||||
### **Solution**
|
||||
|
||||
**Enable `vsyscall` Emulation on the Debian System:**
|
||||
|
||||
1. **Verify Current `vsyscall` Mapping:**
|
||||
|
||||
```bash
|
||||
sudo grep vsyscall /proc/self/maps
|
||||
```
|
||||
|
||||
- If no output is returned, `vsyscall` is not currently mapped.
|
||||
|
||||
2. **Edit GRUB Configuration:**
|
||||
|
||||
- Open the GRUB configuration file:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/default/grub
|
||||
```
|
||||
|
||||
- Locate the line starting with `GRUB_CMDLINE_LINUX_DEFAULT`.
|
||||
|
||||
- Append `vsyscall=emulate` to the existing parameters within the quotes.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash vsyscall=emulate"
|
||||
```
|
||||
|
||||
3. **Update GRUB Settings:**
|
||||
|
||||
- Apply the changes by updating GRUB:
|
||||
|
||||
```bash
|
||||
sudo update-grub
|
||||
```
|
||||
|
||||
4. **Reboot the System:**
|
||||
|
||||
- Restart your machine to apply the new kernel parameter:
|
||||
|
||||
```bash
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
5. **Confirm `vsyscall` is Enabled:**
|
||||
|
||||
- After rebooting, check if `vsyscall` is now mapped:
|
||||
|
||||
```bash
|
||||
sudo grep vsyscall /proc/self/maps
|
||||
```
|
||||
|
||||
- You should see an output similar to:
|
||||
|
||||
```
|
||||
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
|
||||
```
|
||||
|
||||
6. **Run the Docker Container Again:**
|
||||
|
||||
- With `vsyscall` emulation enabled, attempt to start the Oracle container:
|
||||
|
||||
```bash
|
||||
docker run -idt --name oracle -h oracle --privileged=true --shm-size=2g \
|
||||
-p 1521:1521 -p 2222:22 lhrbest/oracle_11g_ee_lhr_11.2.0.4:2.0 init
|
||||
```
|
||||
|
||||
- The container should now start successfully without exiting.
|
||||
|
||||
---
|
||||
|
||||
### **Explanation of the Solution**
|
||||
|
||||
- **`vsyscall=emulate` Kernel Parameter:**
|
||||
- Tells the kernel to emulate the old `vsyscall` behavior, allowing legacy applications to function correctly.
|
||||
- Balances compatibility with security, as emulation is safer than direct mapping.
|
||||
|
||||
- **Why It Works:**
|
||||
- Restores the expected environment for Oracle 11g, preventing segmentation faults caused by missing `vsyscall` support.
|
||||
|
||||
---
|
||||
|
||||
### **Additional Considerations**
|
||||
|
||||
- **Security Implications:**
|
||||
- Enabling `vsyscall` emulation is generally safe but reintroduces some legacy code paths.
|
||||
- The risk is minimal for most users, but it's important to keep the system updated.
|
||||
|
||||
- **Alternate Solutions:**
|
||||
- **Upgrade Oracle Version:**
|
||||
- Consider using a newer version of Oracle that doesn't rely on `vsyscall`.
|
||||
- **Use an Older Kernel:**
|
||||
- Downgrading the kernel to a version where `vsyscall` is enabled by default.
|
||||
- Not recommended due to potential security vulnerabilities.
|
||||
|
||||
- **Documentation and References:**
|
||||
- Similar issues and solutions have been documented in various repositories:
|
||||
- [JiscSD/rdss-archivematica Issue #65](https://github.com/JiscSD/rdss-archivematica/issues/65)
|
||||
- [Enalean/docker-tuleap-aio Issue #57](https://github.com/Enalean/docker-tuleap-aio/issues/57)
|
||||
- [moby/moby Issue #28705](https://github.com/moby/moby/issues/28705)
|
||||
|
||||
---
|
||||
|
||||
### **Summary**
|
||||
|
||||
- **Problem:**
|
||||
- The Oracle 11g Docker container was exiting with a segmentation fault on Debian due to `vsyscall` being disabled in the kernel.
|
||||
|
||||
- **Solution:**
|
||||
- Enabling `vsyscall` emulation by adding `vsyscall=emulate` to the kernel boot parameters in GRUB.
|
||||
- Updating GRUB and rebooting the system applied the changes.
|
||||
- The container then started successfully.
|
||||
|
||||
---
|
||||
|
||||
**By adjusting the kernel parameter to enable `vsyscall` emulation, you resolved the compatibility issue between Oracle 11g and the modern Debian kernel, allowing the Docker container to run without errors.**
|
||||
|
||||
---
|
||||
|
||||
If you have any further questions or need assistance with other issues, feel free to ask!
|
||||
@@ -0,0 +1,372 @@
|
||||
|
||||
http://211.23.61.114/ISO/OracleDB/Ora11g11.2.0.4/
|
||||
|
||||
|
||||
|
||||
```db_install.rsp
|
||||
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
|
||||
oracle.install.option=INSTALL_DB_SWONLY
|
||||
ORACLE_HOSTNAME=oradb
|
||||
UNIX_GROUP_NAME=oinstall
|
||||
INVENTORY_LOCATION=/u01/app/oraInventory
|
||||
SELECTED_LANGUAGES=en,zh_CN
|
||||
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
|
||||
ORACLE_BASE=/u01/app/oracle
|
||||
oracle.install.db.InstallEdition=EE
|
||||
oracle.install.db.EEOptionsSelection=false
|
||||
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
|
||||
oracle.install.db.DBA_GROUP=dba
|
||||
oracle.install.db.OPER_GROUP=dba
|
||||
oracle.install.db.CLUSTER_NODES=
|
||||
oracle.install.db.isRACOneInstall=
|
||||
oracle.install.db.racOneServiceName=
|
||||
oracle.install.db.config.starterdb.type=
|
||||
oracle.install.db.config.starterdb.globalDBName=
|
||||
oracle.install.db.config.starterdb.SID=
|
||||
oracle.install.db.config.starterdb.characterSet=AL32UTF8
|
||||
oracle.install.db.config.starterdb.memoryOption=true
|
||||
oracle.install.db.config.starterdb.memoryLimit=
|
||||
oracle.install.db.config.starterdb.installExampleSchemas=false
|
||||
oracle.install.db.config.starterdb.enableSecuritySettings=true
|
||||
oracle.install.db.config.starterdb.password.ALL=oracle
|
||||
oracle.install.db.config.starterdb.password.SYS=
|
||||
oracle.install.db.config.starterdb.password.SYSTEM=
|
||||
oracle.install.db.config.starterdb.password.SYSMAN=
|
||||
oracle.install.db.config.starterdb.password.DBSNMP=
|
||||
oracle.install.db.config.starterdb.control=DB_CONTROL
|
||||
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
|
||||
oracle.install.db.config.starterdb.automatedBackup.enable=false
|
||||
oracle.install.db.config.starterdb.automatedBackup.osuid=
|
||||
oracle.install.db.config.starterdb.automatedBackup.ospwd=
|
||||
oracle.install.db.config.starterdb.storageType=
|
||||
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
|
||||
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
|
||||
oracle.install.db.config.asm.diskGroup=
|
||||
oracle.install.db.config.asm.ASMSNMPPassword=
|
||||
MYORACLESUPPORT_USERNAME=
|
||||
MYORACLESUPPORT_PASSWORD=
|
||||
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
|
||||
DECLINE_SECURITY_UPDATES=true
|
||||
PROXY_HOST=
|
||||
PROXY_PORT=
|
||||
PROXY_USER=
|
||||
PROXY_PWD=
|
||||
PROXY_REALM=
|
||||
COLLECTOR_SUPPORTHUB_URL=
|
||||
oracle.installer.autoupdates.option=
|
||||
oracle.installer.autoupdates.downloadUpdatesLoc=
|
||||
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
|
||||
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
|
||||
```
|
||||
|
||||
|
||||
Dockerfile-inst
|
||||
```Dockerfile
|
||||
FROM oralcelinux:6.10
|
||||
ARG NLS_LANG
|
||||
ARG ORACLE_SID
|
||||
ADD rlwrap-0.42.tar.gz /tmp/
|
||||
ADD p13390677_112040_Linux-x86-64_1of7.zip /tmp/
|
||||
ADD p13390677_112040_Linux-x86-64_2of7.zip /tmp/
|
||||
ADD db_install.rsp /tmp/
|
||||
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle && \
|
||||
yum -y install oracle-rdbms-server-11gR2-preinstall unzip readline-devel.x86_64 lrzsz && \
|
||||
cd /tmp/rlwrap-0.42 && ./configure && make && make install && \
|
||||
echo "Create /u01/app dir..." && \
|
||||
mkdir -p -m 755 /u01/app/dumpdir && \
|
||||
mkdir -p -m 755 /u01/app/oradata && \
|
||||
mkdir -p -m 755 /u01/app/oraInventory && \
|
||||
mkdir -p -m 755 /u01/app/oracle && \
|
||||
mkdir -p -m 755 /u01/app/oracle/product/11.2.0/db_1 && \
|
||||
chown -R oracle:oinstall /u01 && \
|
||||
unzip -oq /tmp/p13390677_112040_Linux-x86-64_1of7.zip -d /tmp/ && \
|
||||
unzip -oq /tmp/p13390677_112040_Linux-x86-64_2of7.zip -d /tmp/ && \
|
||||
chown -R oracle:oinstall /tmp/database && \
|
||||
printf "%s\n" 'export ORACLE_SID=${ORACLE_SID:orcl}' \
|
||||
'export ORACLE_BASE=/u01/app/oracle' \
|
||||
'export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1' \
|
||||
'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32' \
|
||||
'export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch' \
|
||||
'export NLS_LANG=${NLS_LANG:-AMERICAN_AMERICA.ZHS16GBK}' \
|
||||
'export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"' \
|
||||
'alias sqlplus="rlwrap sqlplus"' \
|
||||
'alias rman="rlwrap rman"' \
|
||||
>>/home/oracle/.bash_profile && \
|
||||
cat /etc/security/limits.conf | grep -v oracle | tee /etc/security/limits.conf && \
|
||||
su oracle -c "/tmp/database/runInstaller -ignorePrereq -ignoreSysPrereqs -waitforcompletion -silent -responseFile /tmp/db_install.rsp 2>&1" && \
|
||||
/u01/app/oraInventory/orainstRoot.sh && \
|
||||
/u01/app/oracle/product/11.2.0/db_1/root.sh && \
|
||||
yum clean all && \
|
||||
rm -rf /tmp/* && rm -rf /var/log/* && rm -rf /var/cache/*
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
build-inst.sh:
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
imagetag="oracle:11.2.0.4-inst"
|
||||
dockerfile="Dockerfile-inst"
|
||||
docker build --rm \
|
||||
--force-rm \
|
||||
--no-cache \
|
||||
--memory=4g \
|
||||
--shm-size=4g \
|
||||
-t ${imagetag} \
|
||||
-f ${dockerfile} .
|
||||
```
|
||||
|
||||
|
||||
Dockerfile-db
|
||||
```Dockerfile
|
||||
FROM oracle:11.2.0.4-inst
|
||||
|
||||
# Set environment variables
|
||||
ENV ORACLE_BASE=/u01/app/oracle
|
||||
ENV ORACLE_HOME=${ORACLE_BASE}/product/11.2.0/db_1
|
||||
ENV PATH=$PATH:${ORACLE_HOME}/bin
|
||||
|
||||
# Build arguments with default password values
|
||||
ARG SYSPASSWORD=admingzzn
|
||||
ARG SYSTEMPASSWORD=admingzzn
|
||||
ARG ORACLE_SID=orcl
|
||||
|
||||
# Set environment variables for oracle user
|
||||
RUN printf "%s\n" \
|
||||
'export ORACLE_BASE=/u01/app/oracle' \
|
||||
'export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1' \
|
||||
'export ORACLE_SID=$ORACLE_SID' \
|
||||
'export PATH=$PATH:$ORACLE_HOME/bin' \
|
||||
>> /home/oracle/.bash_profile
|
||||
|
||||
|
||||
RUN printf "%s\n" '[GENERAL]' \
|
||||
'RESPONSEFILE_VERSION="11.2"' \
|
||||
'CREATE_TYPE="CUSTOM"' \
|
||||
'[oracle.net.ca]' \
|
||||
'INSTALLED_COMPONENTS={"server","net8","javavm"}' \
|
||||
'INSTALL_TYPE=""typical""' \
|
||||
'LISTENER_NUMBER=1' \
|
||||
'LISTENER_NAMES={"LISTENER"}' \
|
||||
'LISTENER_PROTOCOLS={"TCP;1521"}' \
|
||||
'LISTENER_START=""LISTENER""' \
|
||||
'NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}' \
|
||||
'NSN_NUMBER=1' \
|
||||
'NSN_NAMES={"EXTPROC_CONNECTION_DATA"}' \
|
||||
'NSN_SERVICE={"PLSExtProc"}' \
|
||||
'NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}' \
|
||||
>>/tmp/netca.rsp && \
|
||||
su oracle -c "/u01/app/oracle/product/11.2.0/db_1/bin/netca -silent -responseFile /tmp/netca.rsp" && \
|
||||
printf "%s\n" '[GENERAL]' \
|
||||
'RESPONSEFILE_VERSION = "11.2.0"' \
|
||||
'OPERATION_TYPE = "createDatabase"' \
|
||||
'[CREATEDATABASE]' \
|
||||
'GDBNAME = "${ORACLE_SID}"' \
|
||||
'DATABASECONFTYPE = "SI"' \
|
||||
'SID = "orcl"' \
|
||||
'TEMPLATENAME = "General_Purpose.dbc"' \
|
||||
'SYSPASSWORD = \"${SYSPASSWORD}\"' \
|
||||
'SYSTEMPASSWORD = \"${SYSTEMPASSWORD}\"' \
|
||||
'DATAFILEDESTINATION=/u01/app/oradata' \
|
||||
'RECOVERYAREADESTINATION=/u01/app/oradata' \
|
||||
'STORAGETYPE=FS' \
|
||||
'CHARACTERSET="ZHS16GBK"' \
|
||||
'INITPARAMS = "java_jit_enabled=false,memory_target=0,sga_target=2048,pga_aggregate_target=300,processes=300,open_cursors=300"' \
|
||||
'AUTOMATICMEMORYMANAGEMENT="False"' \
|
||||
> /tmp/dbca.rsp && chown oracle:oinstall /tmp/dbca.rsp && chmod +x /tmp/dbca.rsp && \
|
||||
su oracle -c "/u01/app/oracle/product/11.2.0/db_1/bin/dbca -silent -responseFile /tmp/dbca.rsp" && \
|
||||
sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config && \
|
||||
echo "export LANG=en_US.utf8" >> /etc/profile
|
||||
|
||||
# Cleanup
|
||||
RUN yum clean all && \
|
||||
rm -rf /tmp/* /var/log/* /var/cache/*
|
||||
|
||||
```
|
||||
|
||||
build-db.sh
|
||||
```bash
|
||||
imagetag="oracle:11.2.0.4-db"
|
||||
dockerfile="Dockerfile-db"
|
||||
docker build --rm \
|
||||
--force-rm \
|
||||
--no-cache \
|
||||
--memory=4g \
|
||||
--shm-size=4g \
|
||||
-t ${imagetag} \
|
||||
-f ${dockerfile} .
|
||||
```
|
||||
|
||||
|
||||
entrypoint_oracle.sh:
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
source ~/.bashrc
|
||||
alert_log="$ORACLE_BASE/diag/rdbms/orcl/$ORACLE_SID/trace/alert_$ORACLE_SID.log"
|
||||
listener_log="$ORACLE_BASE/diag/tnslsnr/$HOSTNAME/listener/trace/listener.log"
|
||||
pfile=$ORACLE_HOME/dbs/init$ORACLE_SID.ora
|
||||
# monitor $logfile
|
||||
monitor() {
|
||||
tail -F -n 0 $1 | while read line; do echo -e "$2: $line"; done
|
||||
}
|
||||
trap_db() {
|
||||
trap "echo 'Caught SIGTERM signal, shutting down...'; stop_db" SIGTERM;
|
||||
trap "echo 'Caught SIGINT signal, shutting down...'; stop_db" SIGINT;
|
||||
}
|
||||
# Check shared memory
|
||||
check_shm() {
|
||||
echo ""
|
||||
echo "Checking shared memory..."
|
||||
df -h | grep "Mounted on" && df -h | egrep --color "^.*/dev/shm" || echo "Shared memory is not mounted."
|
||||
}
|
||||
# Reconfig listener
|
||||
reconfig_lsnr() {
|
||||
echo ""
|
||||
echo "Reconfig listener for hostname : [$HOSTNAME]..."
|
||||
sed -i "s/(HOST.*)(/(HOST = $HOSTNAME)(/g" /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
|
||||
sed -i "s/(HOST.*)(/(HOST = $HOSTNAME)(/g" /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
|
||||
echo "Show tnsnames.ora..."
|
||||
cat /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
|
||||
echo "Show listener.ora..."
|
||||
cat /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
|
||||
}
|
||||
# Start listener
|
||||
start_lsnr() {
|
||||
echo ""
|
||||
echo "Starting listener..."
|
||||
monitor $listener_log listener &
|
||||
lsnrctl start | while read line; do echo -e "lsnrctl: $line"; done
|
||||
MON_LSNR_PID=$!
|
||||
}
|
||||
# Start database
|
||||
start_db() {
|
||||
echo ""
|
||||
echo "Starting database..."
|
||||
trap_db
|
||||
monitor $alert_log alertlog &
|
||||
MON_ALERT_PID=$!
|
||||
sqlplus / as sysdba <<-EOF |
|
||||
pro Starting with pfile='$pfile' ...
|
||||
startup;
|
||||
alter system register;
|
||||
exit 0
|
||||
EOF
|
||||
while read line; do echo -e "sqlplus: $line"; done
|
||||
change_dpdump_dir
|
||||
change_profile_default_limit
|
||||
wait $MON_ALERT_PID
|
||||
}
|
||||
# Stop database
|
||||
stop_db() {
|
||||
trap '' SIGINT SIGTERM
|
||||
shut_immediate
|
||||
echo "Shutting down listener..."
|
||||
lsnrctl stop | while read line; do echo -e "lsnrctl: $line"; done
|
||||
kill $MON_ALERT_PID $MON_LSNR_PID
|
||||
exit 0
|
||||
}
|
||||
shut_immediate() {
|
||||
ps -ef | grep ora_pmon | grep -v grep > /dev/null && \
|
||||
echo "Shutting down the database..." && \
|
||||
sqlplus / as sysdba <<-EOF |
|
||||
set echo on
|
||||
shutdown immediate;
|
||||
exit 0
|
||||
EOF
|
||||
while read line; do echo -e "sqlplus: $line"; done
|
||||
}
|
||||
# change_dpdump_dir
|
||||
change_dpdump_dir () {
|
||||
echo ""
|
||||
echo "Changing dpdump dir to /u01/app/dumpdir"
|
||||
sqlplus / as sysdba <<-EOF |
|
||||
create or replace directory data_pump_dir as '/u01/app/dumpdir';
|
||||
commit;
|
||||
exit 0
|
||||
EOF
|
||||
while read line; do echo -e "sqlplus: $line"; done
|
||||
}
|
||||
# change profile default limit
|
||||
change_profile_default_limit() {
|
||||
echo ""
|
||||
echo "Changing profile default limit : password_life_time/failed_login_attempts"
|
||||
sqlplus / as sysdba <<-EOF |
|
||||
alter profile default limit password_life_time unlimited;
|
||||
alter profile default limit failed_login_attempts unlimited;
|
||||
commit;
|
||||
exit 0
|
||||
EOF
|
||||
while read line; do echo -e "sqlplus: $line"; done
|
||||
}
|
||||
# Check shared memory
|
||||
check_shm
|
||||
# Reconfig listener
|
||||
reconfig_lsnr
|
||||
# Start listener
|
||||
start_lsnr
|
||||
# Start database
|
||||
start_db
|
||||
```
|
||||
|
||||
entrypoint.sh :
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
/etc/init.d/sshd start
|
||||
find /u01 ! -user oracle -o ! -group oinstall -exec chown oracle:oinstall {} +
|
||||
su - oracle -c "/usr/sbin/entrypoint_oracle.sh"
|
||||
```
|
||||
|
||||
Dockerfile-run
|
||||
```Dockerfile
|
||||
# Use Oracle Database 11.2.0.4 as the base image
|
||||
FROM oracle:11.2.0.4-db
|
||||
|
||||
# Set the timezone to Shanghai
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
# Set environment variables
|
||||
ENV LANG=en_US.utf8
|
||||
|
||||
# Copy entry point scripts
|
||||
ADD entrypoint.sh /usr/sbin/entrypoint.sh
|
||||
ADD entrypoint_oracle.sh /usr/sbin/entrypoint_oracle.sh
|
||||
|
||||
# Make scripts executable
|
||||
RUN chmod +x /usr/sbin/entrypoint.sh /usr/sbin/entrypoint_oracle.sh
|
||||
|
||||
# Modify SSH configuration (with security considerations)
|
||||
# It's recommended to create a non-root user and use SSH keys
|
||||
# RUN sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
|
||||
|
||||
# Set the root password securely (not recommended to hardcode)
|
||||
# ARG ROOT_PASSWORD
|
||||
# RUN echo "root:${ROOT_PASSWORD}" | chpasswd
|
||||
|
||||
EXPOSE 1521
|
||||
|
||||
# Set the entry point
|
||||
ENTRYPOINT ["/usr/sbin/entrypoint.sh"]
|
||||
CMD [""]
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
debain can't run oraclelinux
|
||||
```
|
||||
I believe this is the vsyscall=emulate problem:
|
||||
|
||||
If `sudo grep vsyscall /proc/1/maps` prints nothing, then edit `/etc/default/grub` and append `vsyscall=emulate` to the variable `GRUB_CMDLINE_LINUX_DEFAULT`. Then run a `sudo update-grub` and reboot.
|
||||
|
||||
Additional references: [https://github.com/JiscSD/rdss-archivematica/issues/65](https://github.com/JiscSD/rdss-archivematica/issues/65) , [Enalean/docker-tuleap-aio#57](https://github.com/Enalean/docker-tuleap-aio/issues/57) , [moby/moby#28705](https://github.com/moby/moby/issues/28705)
|
||||
|
||||
👍8
|
||||
```
|
||||
@@ -0,0 +1,154 @@
|
||||
--XBOS資料庫設定值取得SQL Script如下:
|
||||
-- 1. 收集資料庫版本資訊
|
||||
select banner from v$version
|
||||
union all
|
||||
select distinct banner from (select 'Oracle Client version '||client_version banner FROM v$session_connect_info WHERE sid = SYS_CONTEXT('USERENV', 'SID'))
|
||||
union all
|
||||
select 'Database CharacterSet: '||value from v$nls_parameters where parameter='NLS_CHARACTERSET'
|
||||
union all
|
||||
select 'Database archive mode: '||log_mode from v$database
|
||||
union all
|
||||
select 'Database Global Name: '||GLOBAL_NAME from GLOBAL_NAME
|
||||
union all
|
||||
select 'Database Server Name: '||host_name from v$instance
|
||||
union all
|
||||
select 'Database Startup Time: '||to_char(startup_time, 'YYYY/MM/DD HH:MI:SS') from v$instance
|
||||
union all
|
||||
select 'Database Client IP: '||sys_context('USERENV', 'IP_ADDRESS') from dual
|
||||
union all
|
||||
select 'Database Trace Log: '||value from v$diag_info where name='Diag Trace';
|
||||
-- 2. 收集資料庫參數設定資訊
|
||||
select name, value from v$parameter2 where name in (
|
||||
'audit_file_dest',
|
||||
'audit_trail',
|
||||
'cluster_database',
|
||||
'cluster_database_instances',
|
||||
'control_files',
|
||||
'control_management_pack_access',
|
||||
'cpu_count',
|
||||
'db_block_size',
|
||||
'db_files',
|
||||
'db_name',
|
||||
'instance_mode',
|
||||
'memory_max_target',
|
||||
'memory_target',
|
||||
'optimizer_features_enable',
|
||||
'pga_aggregate_target',
|
||||
'processes',
|
||||
'remote_login_passwordfile',
|
||||
'service_names',
|
||||
'sessions',
|
||||
'sga_max_size',
|
||||
'sga_target',
|
||||
'spfile',
|
||||
'statistics_level',
|
||||
'user_dump_dest',
|
||||
'utl_file_dir'
|
||||
)
|
||||
order by name;
|
||||
|
||||
-- 3. 收集Tablespace使用空間大小資訊
|
||||
SELECT df.tablespace_name "Tablespace",
|
||||
df.bytes / (1024 * 1024) "Size (MB)",
|
||||
SUM(fs.bytes) / (1024 * 1024) "Free (MB)",
|
||||
Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",
|
||||
Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"
|
||||
FROM dba_free_space fs,
|
||||
(SELECT tablespace_name,SUM(bytes) bytes FROM dba_data_files
|
||||
GROUP BY tablespace_name) df
|
||||
WHERE fs.tablespace_name (+) = df.tablespace_name
|
||||
GROUP BY df.tablespace_name,df.bytes
|
||||
UNION ALL
|
||||
SELECT df.tablespace_name tspace,
|
||||
fs.bytes / (1024 * 1024),
|
||||
SUM(df.bytes_free) / (1024 * 1024),
|
||||
Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes), 1),
|
||||
Round((SUM(fs.bytes) - df.bytes_free) * 100 / fs.bytes)
|
||||
FROM dba_temp_files fs,
|
||||
(SELECT tablespace_name,bytes_free,bytes_used FROM v$temp_space_header
|
||||
GROUP BY tablespace_name,bytes_free,bytes_used) df
|
||||
WHERE fs.tablespace_name (+) = df.tablespace_name
|
||||
GROUP BY df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
|
||||
ORDER BY 1;
|
||||
|
||||
-- 4. 收集Data Files使用空間大小資訊
|
||||
select file_name,tablespace_name, bytes/1048576 "SizeMB", bytes/blocks "BLOCK", autoextensible from dba_data_files
|
||||
union all
|
||||
select file_name,tablespace_name, bytes/1048576 "SizeMB", bytes/blocks "BLOCK", autoextensible from dba_temp_files;
|
||||
|
||||
-- 5. 收集主機名稱資訊
|
||||
select instance_name,host_name,version,startup_time,status from v$instance;
|
||||
|
||||
-- 6. 收集資料庫名稱狀態
|
||||
select dbid, db_unique_name, name, log_mode, open_mode, database_role, guard_status, platform_name, flashback_on from v$database;
|
||||
|
||||
-- 7. 收集表格(tables)使用空間大小資訊
|
||||
select OWNER,TABLE_NAME,NUM_ROWS,BLOCKS,round(BLOCKS/128) as SizeMB,AVG_ROW_LEN,round(AVG_ROW_LEN*NUM_ROWS/1048576) as LenMB
|
||||
from all_tables where owner in ('FBOSPROD', 'XBOSWRNT', 'XBOSPROD') and blocks is not null order by 1, 5 desc;
|
||||
|
||||
-- 8. 收集索引(indexes)使用空間大小資訊
|
||||
select owner, segment_name, bytes/1024/1024 "SizeMB" from dba_segments
|
||||
where owner in ('FBOSPROD', 'XBOSWRNT', 'XBOSPROD') and segment_type = 'INDEX' order by 3 desc;
|
||||
|
||||
-- 9. 收集Partition Table設定資訊
|
||||
select table_name, partition_name, num_rows, round(blocks/128, 2) SizeMB, last_analyzed
|
||||
from dba_tab_statistics where owner in ('FBOSPROD', 'XBOSWRNT', 'XBOSPROD');
|
||||
|
||||
--10. 收集資料表空間使用額度
|
||||
select tablespace_name,username,max_bytes,max_blocks from dba_ts_quotas where username in ('FBOSPROD', 'XBOSWRNT', 'XBOSPROD');
|
||||
|
||||
--11. 收集資料庫SYS權限設定
|
||||
select * from dba_sys_privs where grantee in ('FBOSPROD', 'WRNTPROD', 'XBOSPROD')
|
||||
union all
|
||||
select * from dba_sys_privs where grantee in ('FBOSLOAD', 'WRNTLOAD', 'XBOSLOAD')
|
||||
union all
|
||||
select * from dba_sys_privs where grantee in ('FBOSLOAD_ROLE', 'WRNTLOAD_ROLE', 'XBOSLOAD_ROLE')
|
||||
order by 1, 2;
|
||||
|
||||
--12. 收集資料庫ROLE權限設定
|
||||
select * from dba_role_privs where grantee in ('FBOSPROD', 'WRNTPROD', 'XBOSPROD')
|
||||
union all
|
||||
select * from dba_role_privs where grantee in ('FBOSLOAD', 'WRNTLOAD', 'XBOSLOAD')
|
||||
union all
|
||||
select * from dba_role_privs where grantee in ('FBOSLOAD_ROLE', 'WRNTLOAD_ROLE', 'XBOSLOAD_ROLE')
|
||||
order by 1, 2;
|
||||
|
||||
--14. 收集資料庫User Objects Count
|
||||
select owner, object_type, count(*) from dba_objects
|
||||
where owner in ('FBOSPROD', 'WRNTPROD', 'XBOSPROD')
|
||||
group by owner, object_type, object_type order by 1, 2;
|
||||
select owner, object_type, count(*) from dba_objects
|
||||
where owner in ('FBOSLOAD', 'WRNTLOAD', 'XBOSLOAD')
|
||||
group by owner, object_type, object_type order by 1, 2;
|
||||
|
||||
--15. 收集物件授權Scripts語法
|
||||
select 'GRANT DELETE, INSERT, SELECT, UPDATE ON XBOSPROD.' || object_name || ' TO XBOSLOAD;' GRANT_TEXT
|
||||
from dba_objects where owner = 'XBOSPROD' and object_type = 'TABLE'
|
||||
union all
|
||||
select 'GRANT EXECUTE ON XBOSPROD.' || object_name || ' TO XBOSLOAD;' GRANT_TEXT
|
||||
from dba_objects where owner = 'XBOSPROD' and object_type in('FUNCTION','PACKAGE','PACKAGE BODY','PROCEDURE')
|
||||
union all
|
||||
select 'GRANT ALTER, SELECT ON XBOSPROD.' || object_name || ' TO XBOSLOAD;' GRANT_TEXT
|
||||
from dba_objects where owner = 'XBOSPROD' and object_type = 'SEQUENCE'
|
||||
union all
|
||||
select 'GRANT SELECT ON XBOSPROD.' || object_name || ' TO XBOSLOAD;' GRANT_TEXT
|
||||
from dba_objects where owner = 'XBOSPROD' and object_type = 'VIEW'
|
||||
order by GRANT_TEXT;
|
||||
|
||||
--16. 收集Create Synonym Scripts語法
|
||||
select 'create or replace synonym XBOSLOAD.' || object_name || ' for XBOSPROD.'||object_name||';'
|
||||
from dba_objects where owner = 'XBOSPROD';
|
||||
|
||||
--17. Schema OWNER & Table統計值收集Scripts語法
|
||||
select table_name, last_analyzed from user_tab_statistics where table_name = 'TRANSFER_SEND';
|
||||
exec dbms_stats.gather_table_stats(ownname => 'XBOSPROD' , tabname => 'TRANSFER_SEND',cascade => true);
|
||||
exec dbms_stats.gather_schema_stats(ownname => 'XBOSPROD', degree => 4, cascade => true);
|
||||
select table_name, last_analyzed from user_tab_statistics where table_name = 'TRANSFER_SEND';
|
||||
|
||||
--18. Tablespaces & datafiles list
|
||||
select * from v$tablespace; -- NAME, BIGFILE, FLASHBACK_ON
|
||||
select * from v$datafile; -- NAME, BYTES, BLOCKS, BLOCK_SIZE
|
||||
select * from v$tempfile; -- NAME, BYTES, BLOCKS, BLOCK_SIZE
|
||||
select * from dba_tablespaces; -- TABLESPACE_NAME, BIGFILE, BLOCK_SIZE
|
||||
select * from dba_data_files; -- FILE_NAME, TABLESPACE_NAME, BYTES, BLOCKS, AUTOEXTENSIBLE, MAXBYTES, MAXBLOCKS
|
||||
select * from dba_temp_files; -- FILE_NAME, TABLESPACE_NAME, BYTES, BLOCKS, AUTOEXTENSIBLE, MAXBYTES, MAXBLOCKS
|
||||
@@ -0,0 +1,623 @@
|
||||
|
||||
|
||||
|
||||
sunlogin
|
||||
id:orkj8471777m7nfe
|
||||
```password
|
||||
m2mg2Lh*T9w
|
||||
```
|
||||
|
||||
|
||||
|
||||
remote: 795906644
|
||||
```password
|
||||
840la5
|
||||
```
|
||||
|
||||
windows password:
|
||||
```
|
||||
gzzn@123
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
gzzn@123
|
||||
```
|
||||
|
||||
|
||||
|
||||
流水号 0026
|
||||
类型 PLN
|
||||
报文 ZCZC BTZ0026 060338 QU LLFZP8X . QU LLFZP8X .XIYOC9H 060338 PLN 07MAY 01 9H8313 B1163 XIY0455(07MAY) LLF 02 9H8313 B1163 LLF0755(07MAY) HAK 03 9H8314 B1163 HAK1050(07MAY) LLF 04 9H8314 B1163 LLF1405(07MAY) XIY = NNNN
|
||||
接收时间 2025-05-07 12:16:32
|
||||
|
||||
|
||||
```
|
||||
ZCZC
|
||||
BTZ0026 060338 QU LLFZP8X . QU LLFZP8X .XIYOC9H 060338
|
||||
PLN 07MAY
|
||||
01 9H8313 B1163 XIY0455(07MAY) LLF
|
||||
02 9H8313 B1163 LLF0755(07MAY) HAK
|
||||
03 9H8314 B1163 HAK1050(07MAY) LLF
|
||||
04 9H8314 B1163 LLF1405(07MAY) XIY
|
||||
=
|
||||
NNNN
|
||||
```
|
||||
|
||||
|
||||
```groovy
|
||||
// locations to search for config files that get merged into the main config;
|
||||
// config files can be ConfigSlurper scripts, Java properties files, or classes
|
||||
// in the classpath in ConfigSlurper format
|
||||
|
||||
// grails.config.locations = [ "classpath:${appName}-config.properties",
|
||||
// "classpath:${appName}-config.groovy",
|
||||
// "file:${userHome}/.grails/${appName}-config.properties",
|
||||
// "file:${userHome}/.grails/${appName}-config.groovy"]
|
||||
grails.config.locations = [ "file:Quartz-config.groovy"]
|
||||
// if (System.properties["${appName}.config.location"]) {
|
||||
// grails.config.locations << "file:" + System.properties["${appName}.config.location"]
|
||||
// }
|
||||
|
||||
grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination
|
||||
grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format
|
||||
grails.mime.use.accept.header = false
|
||||
grails.mime.types = [
|
||||
all: '*/*',
|
||||
atom: 'application/atom+xml',
|
||||
css: 'text/css',
|
||||
csv: 'text/csv',
|
||||
form: 'application/x-www-form-urlencoded',
|
||||
html: ['text/html','application/xhtml+xml'],
|
||||
js: 'text/javascript',
|
||||
json: ['application/json', 'text/json'],
|
||||
multipartForm: 'multipart/form-data',
|
||||
rss: 'application/rss+xml',
|
||||
text: 'text/plain',
|
||||
xml: ['text/xml', 'application/xml']
|
||||
]
|
||||
|
||||
// URL Mapping Cache Max Size, defaults to 5000
|
||||
//grails.urlmapping.cache.maxsize = 1000
|
||||
|
||||
// What URL patterns should be processed by the resources plugin
|
||||
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']
|
||||
|
||||
// The default codec used to encode data with ${}
|
||||
grails.views.default.codec = "none" // none, html, base64
|
||||
grails.views.gsp.encoding = "UTF-8"
|
||||
grails.converters.encoding = "UTF-8"
|
||||
// enable Sitemesh preprocessing of GSP pages
|
||||
grails.views.gsp.sitemesh.preprocess = true
|
||||
// scaffolding templates configuration
|
||||
grails.scaffolding.templates.domainSuffix = 'Instance'
|
||||
|
||||
// Set to false to use the new Grails 1.2 JSONBuilder in the render method
|
||||
grails.json.legacy.builder = false
|
||||
// enabled native2ascii conversion of i18n properties files
|
||||
grails.enable.native2ascii = true
|
||||
// packages to include in Spring bean scanning
|
||||
grails.spring.bean.packages = []
|
||||
// whether to disable processing of multi part requests
|
||||
grails.web.disable.multipart=false
|
||||
|
||||
// request parameters to mask when logging exceptions
|
||||
grails.exceptionresolver.params.exclude = ['password']
|
||||
|
||||
// configure auto-caching of queries by default (if false you can cache individual queries with 'cache: true')
|
||||
grails.hibernate.cache.queries = false
|
||||
|
||||
|
||||
|
||||
environments {
|
||||
development {
|
||||
grails.logging.jul.usebridge = true
|
||||
}
|
||||
production {
|
||||
grails.logging.jul.usebridge = false
|
||||
// TODO: grails.serverURL = "http://www.changeme.com"
|
||||
}
|
||||
}
|
||||
|
||||
// log4j configuration
|
||||
log4j = {
|
||||
// Example of changing the log pattern for the default console appender:
|
||||
//
|
||||
appenders {
|
||||
// console name:'stdout', layout:pattern(conversionPattern: '%d [%-15.15t] %-5p %-30.30c{1} - %m%n')
|
||||
appender new org.apache.log4j.DailyRollingFileAppender(
|
||||
name:"file",
|
||||
fileName:"logs/telegram.log",
|
||||
append: true,
|
||||
datePattern: '\'_\'yyyy-MM-dd',
|
||||
layout:pattern(conversionPattern: '%d{yy-MM-dd HHmmss}\t%p %-15.15c{1} :: %m%n'))
|
||||
appender new org.apache.log4j.DailyRollingFileAppender(
|
||||
name: "telegram",
|
||||
fileName:"logs/orginal.txt",
|
||||
append: true,
|
||||
datePattern: '\'_\'yyyy-MM-dd',
|
||||
layout:pattern(conversionPattern: '::%d{yyyy-MM-dd HHmmss}:: %m%n'))
|
||||
console name:'stdout', layout:pattern(conversionPattern: ' %d{yy-MM-dd HH:mm:ss} %-5p> %-15.15c{1} :: %m%n')
|
||||
}
|
||||
|
||||
root {
|
||||
info 'stdout', 'file'
|
||||
// additivity = false
|
||||
}
|
||||
|
||||
|
||||
//trace 'org.hibernate.type'
|
||||
|
||||
// info 'grails.app.services',
|
||||
// 'grails.app.utils.tbia.telegram.parser',
|
||||
// info 'grails.app.jobs'
|
||||
// additivity = false
|
||||
|
||||
info 'org.grails.plugin'
|
||||
|
||||
//debug 'grails.app.utils.tbia.telegram.TcpReader'
|
||||
// 'grails.app.services'
|
||||
// 'org.grails.plugin'
|
||||
// 'grails.app.jobs'
|
||||
// additivity: false
|
||||
|
||||
// info 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
|
||||
// info additivity: false,
|
||||
// telegram : ['grails.app.utils.tbia.telegram.TelegramTextLoggerUtils'],
|
||||
// info 'org.codehaus.groovy.grails.web.servlet', // controllers
|
||||
// 'org.hibernate',
|
||||
// 'org.springframework',
|
||||
// 'org.codehaus.groovy.grails.orm.hibernate' // hibernate integration
|
||||
|
||||
|
||||
|
||||
debug telegram: 'grails.app.utils.tbia.telegram.TelegramTextLoggerUtils'
|
||||
|
||||
|
||||
// error 'org.codehaus.groovy.grails.web.servlet', // controllers
|
||||
error 'org.codehaus.groovy.grails.web.pages', // GSP
|
||||
'org.codehaus.groovy.grails.web.sitemesh', // layouts
|
||||
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
|
||||
'org.codehaus.groovy.grails.web.mapping', // URL mapping
|
||||
'org.codehaus.groovy.grails.commons', // core / classloading
|
||||
'org.codehaus.groovy.grails.plugins', // plugins
|
||||
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
|
||||
// 'org.springframework',
|
||||
'org.hibernate',
|
||||
'net.sf.ehcache.hibernate',
|
||||
'grails.app.service.org.grails.plugin'
|
||||
// additivity: false
|
||||
|
||||
|
||||
}
|
||||
|
||||
CIIMS = [
|
||||
url:'http://192.168.50.39:8082/services/ExchangeService',
|
||||
user:'ATC',
|
||||
password:'ATCPASS'
|
||||
]
|
||||
|
||||
localICAO = 'ZGLG'
|
||||
|
||||
TBIARoutes = [
|
||||
estt:'FLOP-ESTT-ATC-ALL',
|
||||
dely:'FLOP-DELY-ATC-ALL',
|
||||
pdda:'FLOP-PDDA-ATC-ALL',
|
||||
actt:'FLOP-ACTT-ATC-ALL',
|
||||
reno:'FLOP-RENO-ATC-ALL',
|
||||
schd:'SCHD-NONE-ATC-ALL'
|
||||
]
|
||||
|
||||
SQL {
|
||||
MAPPING = "SELECT MAPPING_FLIGHT_NUMBER FROM TEL_FLIGHT_MAPPING WHERE OLD_FLIGHT_NUMBER=?"
|
||||
|
||||
//GET_FLIGHT_YESTERDAY = "SELECT scheduled_datetime, route_type FROM TEL_FLIGHTSCHD_NEXTDAY_HISTORY WHERE flight_number = ? and arri_or_dept = ? and flight_date >= to_date(?, 'yyyy-mm-dd') order by flight_date desc"
|
||||
//直接查运营表
|
||||
GET_FLIGHT_YESTERDAY_OPER = """
|
||||
SELECT
|
||||
to_char(scheduled_datetime, 'yyyy-MM-dd HH24MI') as scheduled_datetime,
|
||||
route_type, start_airport, end_airport,
|
||||
aircraft_number
|
||||
FROM
|
||||
FIMS_FLIGHTSCHD_OPERATION
|
||||
WHERE
|
||||
REGEXP_LIKE(FLIGHT_NUMBER, ?)
|
||||
and arri_or_dept = ?
|
||||
and flight_date >= to_date(?, 'yyyy-mm-dd')
|
||||
order by
|
||||
flight_date asc
|
||||
"""
|
||||
GET_FLIGHT_YESTERDAY_HIS = """
|
||||
SELECT
|
||||
to_char(scheduled_datetime, 'yyyy-MM-dd HH24MI') as scheduled_datetime,
|
||||
route_type, start_airport, end_airport,
|
||||
aircraft_number
|
||||
FROM
|
||||
FIMS_FLIGHTSCHD_HST
|
||||
WHERE
|
||||
REGEXP_LIKE(FLIGHT_NUMBER, ?)
|
||||
and arri_or_dept = ?
|
||||
and flight_date >= to_date(?, 'yyyy-mm-dd')
|
||||
order by
|
||||
flight_date asc
|
||||
"""
|
||||
// GET_FLIGHT = "SELECT scheduled_datetime, route_type FROM TEL_FLIGHTSCHD_NEXTDAY_HISTORY WHERE flight_number = ? and arri_or_dept = ? and flight_date = to_date(?, 'yyyy-mm-dd') order by flight_date desc"
|
||||
// 直接查询运营表
|
||||
GET_FLIGHT = """
|
||||
SELECT
|
||||
to_char(scheduled_datetime, 'yyyy-MM-dd HH24MI') as scheduled_datetime,
|
||||
route_type, start_airport, end_airport,
|
||||
aircraft_number
|
||||
FROM
|
||||
FIMS_FLIGHTSCHD_OPERATION
|
||||
WHERE
|
||||
REGEXP_LIKE(FLIGHT_NUMBER, ?)
|
||||
and arri_or_dept = ?
|
||||
and flight_date = to_date(?, 'yyyy-mm-dd')
|
||||
order by
|
||||
flight_date asc
|
||||
"""
|
||||
|
||||
ICAO = "SELECT airline_code_iata FROM sys_airline WHERE airline_code_icao=?"
|
||||
|
||||
COUNT_HIS_ARR_FLT = "SELECT count(*) FROM FIMS_FLIGHTSCHD_HST WHERE flight_number=? and pre_dept_datetime_actual is not null and actual_datetime is not null and arri_or_dept='A' "
|
||||
|
||||
GET_HIS_ARR_FLT = """
|
||||
select * from (
|
||||
select rownum rn, t.* from (
|
||||
SELECT
|
||||
flight_id id,
|
||||
to_char(pre_dept_datetime_actual, 'yyyy-MM-dd HH24MI') pdda,
|
||||
to_char(actual_datetime, 'yyyy-MM-dd HH24MI') actt,
|
||||
flight_date fd
|
||||
FROM
|
||||
FIMS_FLIGHTSCHD_HST
|
||||
WHERE
|
||||
flight_number = ?
|
||||
and pre_dept_datetime_actual is not null
|
||||
and actual_datetime is not null
|
||||
and arri_or_dept='A'
|
||||
order by
|
||||
actt desc
|
||||
) t
|
||||
)
|
||||
where rn <= ?
|
||||
"""
|
||||
|
||||
GET_SEASON_SCHEDULE_FLIGHTS = """
|
||||
SELECT
|
||||
FLIGHT_NUMBER,
|
||||
START_AIRPORT,
|
||||
END_AIRPORT,
|
||||
ARRI_OR_DEPT,
|
||||
to_char(ARRIVAL_TIME, 'HH24MI') as ARRIVAL_TIME,
|
||||
to_char(DEPARTURE_TIME, 'HH24MI') as DEPARTURE_TIME,
|
||||
FLYING_TIME,
|
||||
ROUTE_TYPE,
|
||||
FLIGHT_TASK,
|
||||
OPERATION_DAYS
|
||||
FROM
|
||||
FIMS_FLIGHTSCHD_SEASON, FIMS_FLIGHTSEASON
|
||||
WHERE
|
||||
FIMS_FLIGHTSCHD_SEASON.SEASON_REC_ID = FIMS_FLIGHTSEASON.SEASON_REC_ID
|
||||
and ACTIVESEASON_FLAG = 1
|
||||
ORDER by
|
||||
ARRIVAL_TIME desc, DEPARTURE_TIME desc
|
||||
"""
|
||||
|
||||
GET_AIRCRAFT = """
|
||||
select AIRCRAFT_TYPE_CODE, AIRCRAFT_NUMBER
|
||||
from SYS_AIRCRAFT
|
||||
"""
|
||||
|
||||
GET_AIRPORT = """
|
||||
select
|
||||
AIRPORT_CODE_IATA as THREE,
|
||||
AIRPORT_CODE_ICAO as FOUR,
|
||||
AIRPORT_NAME_CHN as CHN,
|
||||
SYS_COUNTRY.COUNTRY_ID as COUNTRY
|
||||
from
|
||||
SYS_AIRPORT,
|
||||
SYS_CITY,
|
||||
SYS_COUNTRY
|
||||
WHERE
|
||||
SYS_AIRPORT.CITY_ID = SYS_CITY.CITY_ID
|
||||
and SYS_CITY.COUNTRY_ID = SYS_COUNTRY.COUNTRY_ID
|
||||
"""
|
||||
|
||||
}
|
||||
|
||||
pattern =[
|
||||
/**
|
||||
* 上航(FM)解析
|
||||
* 解析参考
|
||||
*W/Z FM9134 B2688 1/1ILS (00) TSN0100 SHA
|
||||
*W/Z FM9133 B2688 1/1ILS (00) SHA0340 TSN
|
||||
*/
|
||||
FM:[
|
||||
fields:[0:'task',1:'flightNumber',2:'registerNumber'],
|
||||
min:7,
|
||||
airway:5,
|
||||
company:"FM"
|
||||
],
|
||||
/**
|
||||
* 解析厦航(MF)计划
|
||||
*01) MF8193 B5595 ILS(8) HGH1100 1305TSN
|
||||
*02) MF8194 B5595 ILS(8) TSN1355 1550HGH
|
||||
*/
|
||||
MF:[
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
min:6,
|
||||
airway:4,
|
||||
company:"MF"
|
||||
],
|
||||
/**
|
||||
* 解析奥凯(8X)计划
|
||||
* 计划参考:
|
||||
*L1: 29OCT BK2735 B2863 ILS IS (3/6) TSN2350(28OCT) HAK
|
||||
*L2: 29OCT BK2735 B2863 ILS IS (3/6) HAK0435 NKG
|
||||
*/
|
||||
"8X":[
|
||||
fields:[1:'flightDate',2:'flightNumber',3:'registerNumber'],
|
||||
min: 9,
|
||||
airway : 7,
|
||||
company : "8X(BK)"
|
||||
],
|
||||
/**
|
||||
* 解析海航(HU)计划
|
||||
* 计划参考
|
||||
*L04 W/Z HU7204 B5637 (9) SZX/0500 TSN
|
||||
*L05 W/Z HU7205 B5406 (9) TSN/2355(30OCT) PVG
|
||||
* 1) JD5195 B6727 ILS I(9) SYX/0800 1135/TSN
|
||||
*
|
||||
*L07 W/Z GS6571 B3155 (7) XIY/0025 TSN/0245 CGQ
|
||||
*/
|
||||
HU:[
|
||||
fields:[1:'task',2:'flightNumber',3:'registerNumber'],
|
||||
min: 5,
|
||||
airway : 5,
|
||||
company : "HU"
|
||||
],
|
||||
/**
|
||||
* 1) JD5195 B6727 ILS I(9) SYX/0800 1135/TSN
|
||||
*/
|
||||
JD: [
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
min:7,
|
||||
airway : 5,
|
||||
company:"JD"
|
||||
],
|
||||
/**
|
||||
* 解析天津航空(GS)公司计划
|
||||
* 解析参考
|
||||
*
|
||||
*L01 W/Z GS6503 B3122 (7) TSN/0730 DLC
|
||||
*L04 W/Z GS6516 B3192 (8) URC/0555 DSN/0920 TSN
|
||||
*L03 W/Z GS6515 B3183 (8) TSN/2320(30OCT) DSN/0145 URC
|
||||
*L55 CNL GS6601 TSN TYN
|
||||
*L44 W/Z GS7533 B3156 (7) XIY/0415 TSN/0645 CGQ
|
||||
*L45 W/Z GS7534 B3156 (7) CGQ/0905 TSN/1145 XIY
|
||||
*
|
||||
* changde
|
||||
* 01 GS7635 B3193 XIY0020(16APR) CGD
|
||||
*/
|
||||
GS: [
|
||||
//fields:[1:'task',2:'flightNumber', 3:'registerNumber'],
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
min:4,
|
||||
airway : 3,
|
||||
company:"GS"
|
||||
],
|
||||
/**
|
||||
* 杨子快运(Y8)
|
||||
*01 Y87969 B2119 XMN 1540 HGH
|
||||
*13 Y87444 B2578 ICN 0235 TSN
|
||||
*/
|
||||
Y8: [
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
min:6,
|
||||
airway : 3,
|
||||
company:"Y8"
|
||||
],
|
||||
/**
|
||||
* 四川航空 (3U)
|
||||
* 01) 31OCT 3U8863 B6598 CAT1 (10) CKG0010 0235TSN
|
||||
*/
|
||||
"3U":[
|
||||
fields:[1:'flightDate',2:'flightNumber', 3:'registerNumber'],
|
||||
min:8,
|
||||
airway : 6,
|
||||
company:"3U"
|
||||
],
|
||||
/**
|
||||
* 中国货运 (CK)
|
||||
*01)H/Z CK261 B2076 PVG1535(30OCT) 1705TPE
|
||||
*/
|
||||
CK:[
|
||||
fields:[0:'task',1:'flightNumber', 2:'registerNumber'],
|
||||
min:4,
|
||||
airway : 3,
|
||||
company:"CK"
|
||||
],
|
||||
/**
|
||||
* 华夏航空 (G5)
|
||||
*L01 W/Z G52665 B7762 (6) CKG/0725 CIH/0940 TSN
|
||||
* 01 G52653 B7762 (6) CKG0015(03FEB) LLF
|
||||
*/
|
||||
G5:[
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
min:4,
|
||||
airway : 3,
|
||||
company:"G5"
|
||||
],
|
||||
/**
|
||||
* 春秋航空 (9C)
|
||||
*31OCT W/Z 9C8884 B6573 ILS1/1 (06) TSN0650 SYX
|
||||
*/
|
||||
"9C":[
|
||||
fields:[0:'flightDate', 1:'task',2:'flightNumber', 3:'registerNumber'],
|
||||
min:8,
|
||||
airway : 6,
|
||||
company:"9C"
|
||||
],
|
||||
/**
|
||||
* 深圳航空 (ZH)
|
||||
*204) W/Z 31OCT ZH9783 B5670 CAT1 (10) SZX0045 0355TSN
|
||||
*/
|
||||
ZH:[
|
||||
fields:[2:'flightDate', 1:'task',3:'flightNumber', 4:'registerNumber'],
|
||||
min:9,
|
||||
airway : 7,
|
||||
company:"ZH"
|
||||
],
|
||||
/**
|
||||
* 翔鹏航空 (8L)
|
||||
*L59 W/Z 8L9976 B6959 TSN/0510 CTU/0855 KMG
|
||||
*/
|
||||
"8L":[
|
||||
fields:[1:'task',2:'flightNumber', 3:'registerNumber'],
|
||||
min:6,
|
||||
airway : 4,
|
||||
company:"8L"
|
||||
],
|
||||
/**
|
||||
* 山东航空 (SC)
|
||||
*(1) SC4717 B3080 CRJ7 ILS I (6) TAO/2350 TSN
|
||||
*/
|
||||
SC:[
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
min:9,
|
||||
airway : 7,
|
||||
company:"SC"
|
||||
],
|
||||
/**
|
||||
* 西部航空 (PN)
|
||||
*21) PN6237 B6763 ILS I(9) CKG/0000 0220/TSN
|
||||
*23) PN6235 B6763 ILS I(9) CKG/0905 1025/WUH/1100 1225/WNZ
|
||||
*/
|
||||
PN:[
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
min:7,
|
||||
airway : 5,
|
||||
company:"PN"
|
||||
],
|
||||
/**
|
||||
* 南方航空 (CZ)
|
||||
*
|
||||
*83. CZ3301/2 B2823 B752 CAN0135 TSN0535 CAN
|
||||
*02. CZ6973/4 B5239 B737 YIN0235 URC0425 PVG0940 URC1545 YIN
|
||||
*/
|
||||
CZ: [
|
||||
fields:[1:'flightNumber', 2:'registerNumber', 3:'aircraftType'],
|
||||
min:6,
|
||||
airway : 4,
|
||||
company:"CZ"
|
||||
],
|
||||
//124) 14NOV W/Z HO1245 B6966 ILS(8) SHA0005 0255CKG
|
||||
//LLF new:
|
||||
//174 Ho1019 B6984 PVG0635(03FEB) LLF
|
||||
HO: [
|
||||
//fields:[1:'flightDate', 2:'task', 3:'flightNumber', 4:'registerNumber'],
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
//min:7,
|
||||
min:4,
|
||||
airway: 3,
|
||||
company: "HO"
|
||||
],
|
||||
//05) 14NOV N/M NS3230 B3188 ILS(2) TSN2200 2240SJW
|
||||
NS: [
|
||||
fields:[1:'flightDate', 2:'task', 3:'flightNumber', 4:'registerNumber'],
|
||||
min:7,
|
||||
airway: 6,
|
||||
company: "NS"
|
||||
],
|
||||
//38)W/Z 27NOV EU2748 B6900 CAT1 (8) TSN0800 1055CTU
|
||||
EU: [
|
||||
fields:[0:'task', 1:'flightDate', 2:'flightNumber', 3:'registerNumber'],
|
||||
min:7,
|
||||
airway: 6,
|
||||
company: "EU"
|
||||
],
|
||||
//01 9H8313 B1163 XIY0455(07MAY) LLF
|
||||
"9H": [
|
||||
fields:[1:'flightNumber', 2:'registerNumber'],
|
||||
min:4,
|
||||
airway: 3,
|
||||
company: "9H"
|
||||
],
|
||||
|
||||
]
|
||||
|
||||
flightType = [
|
||||
H:["H/G", "H/Y"], //货机
|
||||
O:["U/H"], //公务
|
||||
B:["J/B"] //专机
|
||||
]
|
||||
|
||||
|
||||
|
||||
// 17点定时发送计划
|
||||
Plan17Cron = "0 50 16 * * ?"
|
||||
|
||||
// 18点定时发送计划
|
||||
Plan18Cron = "0 50 17 * * ?"
|
||||
|
||||
//对于三字码相同的航空公司,使一部分不实用的机场失效
|
||||
//如果机场真有相同三字码的航空公司,需要修改查询接口,支持多个航空公司
|
||||
disabledAirport = [
|
||||
// 曼谷航空
|
||||
OKA:'PG'
|
||||
]
|
||||
|
||||
// 针对航空公司二字码相同,三字码不同的情况,追加电报本地映射
|
||||
MyAirports = [
|
||||
//内蒙古航空,二字码对应国航的CA
|
||||
CNM:"CA"
|
||||
]
|
||||
|
||||
//针对航班补班的情况,允许在航班号后面加1,2个字母
|
||||
flightNumberPattern = '[A-Z]{0,2}'
|
||||
//yyyy-MM-dd 制定具体日期(系统测试)
|
||||
//now 取系统当前时间
|
||||
// operDate="2012-10-30"
|
||||
operDate="now"
|
||||
|
||||
// 检查过夜航班配置, 值是4表示在4点之前,如果电报中不包含DOF,则检查今天和昨天航班
|
||||
checkHour = 4
|
||||
|
||||
// 计算飞行时长的历史航班数,30表示最近的30次历史飞行的平均值
|
||||
hisFlyTime = 30
|
||||
|
||||
localThree="LLF"
|
||||
//中国ID,用于判断是否是国内航班
|
||||
countryChinaID = 142
|
||||
|
||||
//socket = [server:"172.28.0.3", port:5555]
|
||||
socket = [server:"127.0.0.1", port:7000]
|
||||
|
||||
socketCheckStatus = true
|
||||
|
||||
serial = [baudRate:1200, dataBits:8, stopBits:1, parity:0]
|
||||
|
||||
// windows 默认端口: COM1
|
||||
serialPort = "/Users/windy/Dev/tmp/ttys0"
|
||||
|
||||
//工作模式:
|
||||
//串口:serial, TCP: tcp
|
||||
serviceMode = "tcp"
|
||||
|
||||
//测试模式,当为true的时候,查运营航班数据的时候可以查询历史表(优先查历史表)
|
||||
testMode = false
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
ParsePLN.groovy
|
||||
```groovy
|
||||
static def NORMAL = [
|
||||
'9H' //长安航空
|
||||
]
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user