Commit 8e3656c6 authored by frank.chen's avatar frank.chen

ddddggg

parent fe8af67a
## 概述
- 人工精细化拉网式 code view,比较费时间,不现实。
- 所以使用了 codebuddy AI 辅助分析代码,并日后查漏补缺,持续更新。
## redis 使用
| 名称 | 用途 | 端口 | Redis 地址 |
| -------- | ---------------- | ---- | ---------------------------------------------------- |
| redis1 | 原  SSP 广告数据 | 6379 | redis-cnlflyo8lhn3noc6a.redis.ivolces.com |
| adx | 原  ADX 广告数据 | 6379 | redis-cnlflyo8lhn3noc6a.redis.ivolces.com |
| cluster | 设备 ID 信息 | 6379 | redis-cnlfctnpcm2t3y1ya.redis.ivolces.com |
| cluster3 | DSP trace URL | 6379 | redis-cnlfzzwaj7ww7ko4a.redis.ivolces.com |
| cachelog | 缓存日志 | 6379 | redis-cnlfuuvu9nglr1sez.cn-beijing.redis.ivolces.com |
| userApps | 已安装 app | 6379 | redis-cnlft3byb4ipoiubz.redis.ivolces.com |
| pega | 原百度云 pega | 6379 | redis-cnlfqzc1kxdcesrmz.redis.ivolces.com |
| audience | 用户信息 | 6379 | redis-cnlfuuvu9nglr1sez.cn-beijing.redis.ivolces.com |
| gamekey | 游戏关键词 | 5000 | redis-cnlfl7492fsjp8nba.redis.ivolces.com |
## key
### 广告素材 redis1 adx
| Key | 功能描述 | 类型 |
| --------------------------------- | ---------------------------- | ------ |
| `ssp:dsp:flow_rule` | DSP 流控规则配置 | string |
| `dsprecord_%d-%02d-%02d_%02d_%d` | DSP 广告位计数统计 | hash |
| `ssp:strategy` | 广告策略配置 | hash |
| `ssp:creative:base` | 创意 | hash |
| `ssp:app_info` | | string |
| `ssp:app_info_ex` | | hash |
| `ssp:adpos_info` | | string |
| `ssp:adpos_info_ex` | | hash |
| `ssp:pos:app:filter:installed` | 已安装 App 过滤 | hash |
| `ssp:strategy:yingyongbao` | 应用宝策略集合 | set |
| `ssp:strategy_app_keywords_adpos` | 关键词广告位白名单 | hash |
| `ssp:search:appname:filter` | 应用名过滤列表 | set |
| `defeat_apps` | 竞争 App 配置 | string |
| `tt_competing_app` | 头条竞争 App | string |
| `keyword:union` | 关键词联合 | hash |
| `INTIME_STAT_ALL` | 实时统计 | hash |
| `dsp:specific` | DSP 特殊配置 | hash |
| `dsp:info` | DSP 配置信息 | hash |
| `rta_all` | RTA 配置 | hash |
| `rewards:user:apps` | 用户奖励 App | hash |
| `app_pkg_name` | App 包名映射 | hash |
| `PKG:APID_*` | 包名到 AppID 映射 | set |
| `map_api_level_2_android_ver` | API 版本映射 | hash |
| `media:tencent:business:key` | 腾讯业务 key | string |
| `ocpx:events` | OCPX 事件配置 | hash |
| `"adreq_monitor_" + IP` | ssp  的请求统计 | hash |
| `pos:return:ad` | 返回了广告的请求 url | hash |
| `pos:put:ad_%d-%d-%d-%d` | 活动的投放统计 | hash |
| `dsp:return:ad` | dsp 返回了广告时的请求  url | hash |
| `rta%s_%d-%02d-%02d_%02d_%d` | rta  计数 | hash |
| `[dspname]_pkgs_ex` | 缓存 dsp 不在我们库里的包 | set |
| `pkg_not_in_libs` | 浏览器的特殊需求,包不在库里 | list |
| `ssp:dmp:flow_rule` | 预测流量分配 | string |
| `SerFuncConf` | 记录服务器配置和状态 | hash |
| `ServerStart_[year]` | 服务器启动时间 | hash |
| `ssp:ctr:keywords` | 关键词 预测 活动 ctr | hash |
| `ssp:sensitives` | 敏感词 | string |
| `ssp:page_info` | 某种信息 程序不再使用 可废弃 | string |
| `ssp:action:event` | 特殊事件通知 | list |
### cluster
| Key | 功能描述 | 类型 |
| ---------------------- | -------- | ---- |
| `ssp:strategy:ascribe` | 归因 | hash |
### cluster3
| Key | 功能描述 | 类型 |
| --------------- | ----------------------------------- | ---- |
| `cache_[reqid]` | ssp 投放 dsp 广告时缓存的 trace url | hash |
### cachelog
| Key | 功能描述 | 类型 |
| ------------------------ | --------------------------- | ---- |
| `ssp:nbr-log` | NBR 日志,落盘用 | list |
| `nbr_ssp_%d-%d-%d-%d_%d` | NBR 日志 | hash |
| `dsp:notify` | win loss  后续 dsp 不再使用 | list |
| `dsp:notify:ex` | win loss  加强版 | list |
| `adx:dsp-log` | dsp 匹配日志 | list |
### userApps
| Key | 功能描述 | 类型 |
| ----------------------- | ---------- | ------ |
| `userapps:[uid]` | 已安装 app | string |
| `InTime_INST_APP_[uid]` | 已安装 app | hash |
### pega
| Key | 功能描述 | 类型 |
| -------------------- | --------- | ---- |
| `SSP:UID:OAID:[uid]` | 缓存 oaid | hash |
### audience
| Key | 功能描述 | 类型 |
| ----------- | -------------- | ---- |
| `uid_[uid]` | 用户已下载 app | hash |
### gamekey
| Key | 功能描述 | 类型 |
| ---------------- | ---------- | ------ |
| `game_[keyword]` | 游戏关键词 | string |
## 概述
### nginx-1
- 设置 coredump 生成。待10台都部署好以后,再整理
```
nginx.conf 增加配置
worker_rlimit_core 2048m;
working_directory core_files;
```
- 数据盘处理
- /data/appstore/cached/ 下的文件
- i.gif
- Ipp2.txt
- 待部署完10台后,再开启 nginx-1 的 IntimeStat 定时任务。
- /etc/logrotate.d/intime 日志压缩
- 日志压缩
- 定时任务
- thrift_watch 待改造
- 里头有设置redis和读取redis
### 迁移导致 dsp url 数据错位处理
- 接收到通知时,与匹配时不在一个云上,导致 redis 找不到 dsp 通知 url
- 找不到时,把请求内容倒给另外的云
### 部署系统
- 装在 ssp stg 环境
- Fabric
```
从 百度云的 adx-stg 上找到安装文件 /home/adx-user/tmp/fabric-1.14.0.tar.gz
解压后,执行 python setup.py install
但执行 fab --version 时,提示出错了
执行如下两行
pip install --upgrade pip
pip install --upgrade setuptools
再次执行 fab --version 就没问题了
```
### dmp 失败率邮件
### zzy 地址变更
- ssp nginx
- cpt-bid
### clb
- cpt-bid
- adx-web 的配置要改为新的 clb 内网地址。(待稳定以后再改)
## stg-nginx 服务器
- 购买
- 环境准备
- 部署 Thriftc
- 部署 thrift_watch
- 部署 ssp nginx代码
- 部署 php
- 部署 定时任务
- 部署 Fabric
- 修改 hosts,ssh key
## proxy 服务器
- 购买服务器,也可能直接用原来的
- 检查 nginx 配置
- 部署 超时率 脚本
## adx-stg
- 部署 ssp-notify
- 部署 cpt-bid
- 部署 cpt-tracking
- 部署 ssp-web ssp-core Thriftc
- 部署 action-report
## 其他
- ops-notify 已部署到 log 服务器上
- dsp-notify 业务运行后,检查是否成功转发。
--------------------------------------------
## 详细
- 待zzy部署完,做测试
- adx-web 改配置
- 请求 25 50 51 的,url换内网ip+端口
- 加了新代理服务器
- 整理 nginx-stg 上的工具
- cpt-bid 修改配置,kafka地址、 zzy 地址
\ No newline at end of file
## 基本信息
- 2025-12-9 某些功能废弃,某些移入其他服务器。3台dsp服务器,已陆续退掉
- 3台服务器
- 联盟广告投放
- 共享内存数据接收
......
......@@ -26,6 +26,7 @@
## dsp 转发 winloss
- `/data/dsp-notify`
- 2025-11 月中,该功能转到 adx-trace 服务器,重构为 winloss
## 完整定时任务
......
......@@ -2,17 +2,57 @@
- 2台服务器
- adx-trace
- ssp-notify
- winloss (2025-11-24 左右新加入,proxy 服务器下线该功能)
- cpt-trace (约 2025-10 从 huitoutiao 服务器移过来)
## adx 广告通知
- `/data/adx/release/adx-trace`
- systemctl 常驻
- clb adx-trace-v6
## ssp nginx 通知后续处理
- `/data/adx/release/ssp-notify`
- systemctl 常驻
- clb ssp-notify
## winloss
- `/data/adx/release/winloss`
- systemctl 常驻
## cpt-trace
- `/data/dsp/release/cpt-trace`
- systemctl 常驻
- clb dsptracking
## 完整定时任务
-
## 日志压缩
-
## 新机器部署步骤
- 新加用户 adx-user 和 adminuser。
- 为新用户设置 ssh 登陆,并将代码部署机器的 pub key 放入。
- 修改 sudo 权限
- 注意 将 adx-user 加入 wheel 组。
- 比如:root 下执行 `usermod -aG wheel adx-user`
### 部署 systemctl 启动脚本
- `/usr/lib/systemd/system/` 下创建文件
- adx-trace.service
- winloss.service
- ssp-notify.service
- cpt-trace.service
- 开机启动设置
` systemctl enable xxx.service `
- 检查 `/etc/systemd/system/multi-user.target.wants` 下应该存在上面的服务文件(软链接)。
## sql
- adx-request 统计
```
* | SELECT DATE_FORMAT(__time__ - __time__ % 1000, 'Y-M-d HH:mm:ss') AS time, adpos_id, count(*) where DATE_FORMAT(__time__ - __time__ % 1000, 'Y-M-d HH:mm:ss') > '2025-12-2 09:46:44' group by time, adpos_id order by time,adpos_id LIMIT 1000
```
- 查询 nbr
```
普通查询
* | SELECT req_id , JSON_EXTRACT_SCALAR(nbr, '$.417.43201')
where CAST(JSON_EXTRACT_SCALAR(nbr, '$.417.43201') AS INT) > 0
统计广告位下活动的nbr
* | SELECT JSON_EXTRACT_SCALAR(nbr, '$.351.59149') ,count(JSON_EXTRACT_SCALAR(nbr, '$.351.59149'))
where CAST(JSON_EXTRACT_SCALAR(nbr, '$.351.59149') AS INT) > 0 group by JSON_EXTRACT_SCALAR(nbr, '$.351.59149')
```
## 概述
- 新买服务器时,用的 root,还需要增加 adminuser,某些机器可能还要加 adx-user
- 需要加入 sudo 权限,修改 /etc/sudoers ,并将新用户加入 wheel 组
## adminuser
```
......@@ -13,3 +14,9 @@ passwd adminuser
su adminuser
```
## adx-user
```
groupadd adx-user && useradd -g adx-user adx-user
密码,一般为 Bgc@#41_gwewq098
```
\ No newline at end of file
......@@ -30,3 +30,10 @@ awk -v FS="," '{print $2}' test.txt
- 初始化与扫尾
- BEGIN 表示在第一行之前,执行一次
- END 表示最后一行之后,执行一次
## 例子
```
awk -F "\" \"" '{if($(NF-2)>1) print $(NF-2)+0}' kuaishou-access.log
检查 nginx 日志,倒数第二个字段是连接数序号,如果复用连接,则序号大于1。这里将有连接复用的日志打印出来。
```
\ No newline at end of file
## 查看现有程序的编译参数
```
nginx -V
例如,使用 yum 安装的 nginx 返回:
nginx version: nginx/1.20.1
built by gcc 11.5.0 20240719 (Red Hat 11.5.0-5) (GCC)
built with OpenSSL 3.2.2 4 Jun 2024
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --with-ld-opt='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,-E'
```
## 日志
```
$connection
```
......@@ -18,3 +18,8 @@ sudo vi /etc/sudoers
大约在这里,去掉 %wheel 前的注释
chmod u-w /etc/sudoers
```
### wheel 组
- 一般将 用户 加入 wheel 组
- 也可以在 /etc/sudoers 里,单独加一行,比如:
- adx-user ALL=(ALL) NOPASSWD: ALL
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment