0%

word to markdown

把doc文件转换为docx

1
2
soffice --convert-to docx --outdir whx *.doc*

1
2
3
4
5
6
pandoc -f docx 天津市浩物机电汽车贸易有限公司—安全管理制度汇编.docx --extract-media ./myMediaFolder -o whx1.md -t markdown    

pandoc -f docx 天津市浩物机电汽车贸易有限公司—安全管理制度汇编.docx -t pdf -o whx.pdf



sql server

找出有主键的

1
2
3
4
5
6
7
8
9
USE cwbasehwjd;  -- 切换到目标数据库

SELECT
CONSTRAINT_NAME, -- 获取主键的名称
TABLE_NAME -- 获取主键所在的表名
FROM
INFORMATION_SCHEMA.TABLE_CONSTRAINTS -- 查询表约束信息
WHERE
CONSTRAINT_TYPE = 'PRIMARY KEY'; -- 只筛选主键

找出没有主键的表

1
2
3
4
5
6
7
USE cwbasehwjd;  -- 切换到目标数据库


SELECT name FROM sys.tables
EXCEPT
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE CONSTRAINT_TYPE = 'PRIMARY KEY'

ms做法

1
2
3
4
5
6
7
8
9
10
11
12
13
USE [cwbasehwjd];  
GO
SELECT SCHEMA_NAME(t.schema_id) AS schema_name
,t.name AS table_name
FROM sys.tables t
WHERE object_id NOT IN
(
SELECT parent_object_id
FROM sys.key_constraints
WHERE type_desc = 'PRIMARY_KEY_CONSTRAINT' -- or type = 'PK'
);
GO

脚本寻找

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
USE cwbasehwjd;  -- 切换到目标数据库

declare @TableName nvarchar(250)--游标中取出的数据表名
declare @AllTableHasPrimaryKey int--是否全部都有主键
set @AllTableHasPrimaryKey=1
--声明读取数据库所有数据表名和编号的游标
declare mycursor cursor for select name from dbo.SysObjects WHERE OBJECTPROPERTY(ID, 'IsUserTable') = 1 order by name
--打开游标
open mycursor
--从游标里取出数据赋值到我们刚才声明的数据表名变量中
fetch next from mycursor into @TableName
--如果游标执行成功
while (@@fetch_status=0)
begin

--判断当前数据表是否存在主键
IF NOT EXISTS (select * from information_schema.key_column_usage where TABLE_NAME=''+@TableName+'')
begin
set @AllTableHasPrimaryKey=0;
print '当前数据表['+@TableName+']没有主键'
end

--用游标去取下一条记录
fetch next from mycursor into @TableName
end

if(@AllTableHasPrimaryKey=1)
begin
print '数据库中所有数据表都有主键'
end

--关闭游标
close mycursor
--撤销游标
deallocate mycursor
--脚本代码结束

查看每个表占用空间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SELECT  db_name() as DbName,
t.NAME AS TableName,
s.Name AS SchemaName,
p.rows AS RowCounts,
SUM(a.total_pages) * 8 AS TotalSpaceKB,
CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS 总共占用空间MB,
SUM(a.used_pages) * 8 AS UsedSpaceKB,
CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS UsedSpaceMB,
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB,
CAST(ROUND(((SUM(a.total_pages) - SUM(a.used_pages)) * 8) / 1024.00, 2) AS NUMERIC(36, 2)) AS UnusedSpaceMB
,
t.create_date AS CreatedDate,
t.modify_date AS LastModifiedDate
FROM
sys.tables t
INNER JOIN
sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN
sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN
sys.allocation_units a ON p.partition_id = a.container_id
LEFT OUTER JOIN
sys.schemas s ON t.schema_id = s.schema_id
WHERE
t.NAME NOT LIKE 'dt%'
AND t.is_ms_shipped = 0
AND i.OBJECT_ID > 0
GROUP BY
t.Name, s.Name, p.Rows,t.create_date,t.modify_date
ORDER BY
总共占用空间MB desc

查看每个表的修改时间

1
2
3
4
5
6
7
SELECT 
name AS TableName,
create_date AS CreatedDate,
modify_date AS LastModifiedDate
FROM
sys.tables
order by LastModifiedDate asc

问题:在同一个sql中,将一个数据库如test备份后,新建一个数据库用test备份文件进行覆盖还原,待还原成功的时候,test数据库一直显示“正在还原”。 在这种状态下,由于未提交的事务没有回滚,导致数据库不可以访问。

解决:新建查询,执行restore database XXX with recovery语句后正常 – XXX代表数据库名称

dify 能做什么?

  • 快速将ai 应用穿衣变为现实
  • 将llm继承至现有业务
  • 欧维企业级的llm基础设施
  • 探索llm的能力边界

docker-compose 安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
version: '3'
services:
clickhouse:
image: yandex/clickhouse-server
container_name: clickhouse
ports:
- 9009:9009
- 9000:9000
- 8123:8123
networks:
- clickhouse
volumes:
- ./clickhouse:/var/lib/clickhouse
- ./data:/data

networks:
clickhouse:
driver: bridge

苹果:

1
./clickhouse-macos-aarch64v23.8.9.54 server

建库:

1
2
3

clickhouse-client --host clickhouse-server
clickhouse-client --host clickhouse-server --query "CREATE DATABASE IF NOT EXISTS tutorial"

macos

1
2
$ ./clickhouse-macos-aarch64v23.8.9.54 server client
CREATE DATABASE IF NOT EXISTS tutorial

建表:

hits_v1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
CREATE TABLE tutorial.hits_v1
(
`WatchID` UInt64,
`JavaEnable` UInt8,
`Title` String,
`GoodEvent` Int16,
`EventTime` DateTime,
`EventDate` Date,
`CounterID` UInt32,
`ClientIP` UInt32,
`ClientIP6` FixedString(16),
`RegionID` UInt32,
`UserID` UInt64,
`CounterClass` Int8,
`OS` UInt8,
`UserAgent` UInt8,
`URL` String,
`Referer` String,
`URLDomain` String,
`RefererDomain` String,
`Refresh` UInt8,
`IsRobot` UInt8,
`RefererCategories` Array(UInt16),
`URLCategories` Array(UInt16),
`URLRegions` Array(UInt32),
`RefererRegions` Array(UInt32),
`ResolutionWidth` UInt16,
`ResolutionHeight` UInt16,
`ResolutionDepth` UInt8,
`FlashMajor` UInt8,
`FlashMinor` UInt8,
`FlashMinor2` String,
`NetMajor` UInt8,
`NetMinor` UInt8,
`UserAgentMajor` UInt16,
`UserAgentMinor` FixedString(2),
`CookieEnable` UInt8,
`JavascriptEnable` UInt8,
`IsMobile` UInt8,
`MobilePhone` UInt8,
`MobilePhoneModel` String,
`Params` String,
`IPNetworkID` UInt32,
`TraficSourceID` Int8,
`SearchEngineID` UInt16,
`SearchPhrase` String,
`AdvEngineID` UInt8,
`IsArtifical` UInt8,
`WindowClientWidth` UInt16,
`WindowClientHeight` UInt16,
`ClientTimeZone` Int16,
`ClientEventTime` DateTime,
`SilverlightVersion1` UInt8,
`SilverlightVersion2` UInt8,
`SilverlightVersion3` UInt32,
`SilverlightVersion4` UInt16,
`PageCharset` String,
`CodeVersion` UInt32,
`IsLink` UInt8,
`IsDownload` UInt8,
`IsNotBounce` UInt8,
`FUniqID` UInt64,
`HID` UInt32,
`IsOldCounter` UInt8,
`IsEvent` UInt8,
`IsParameter` UInt8,
`DontCountHits` UInt8,
`WithHash` UInt8,
`HitColor` FixedString(1),
`UTCEventTime` DateTime,
`Age` UInt8,
`Sex` UInt8,
`Income` UInt8,
`Interests` UInt16,
`Robotness` UInt8,
`GeneralInterests` Array(UInt16),
`RemoteIP` UInt32,
`RemoteIP6` FixedString(16),
`WindowName` Int32,
`OpenerName` Int32,
`HistoryLength` Int16,
`BrowserLanguage` FixedString(2),
`BrowserCountry` FixedString(2),
`SocialNetwork` String,
`SocialAction` String,
`HTTPError` UInt16,
`SendTiming` Int32,
`DNSTiming` Int32,
`ConnectTiming` Int32,
`ResponseStartTiming` Int32,
`ResponseEndTiming` Int32,
`FetchTiming` Int32,
`RedirectTiming` Int32,
`DOMInteractiveTiming` Int32,
`DOMContentLoadedTiming` Int32,
`DOMCompleteTiming` Int32,
`LoadEventStartTiming` Int32,
`LoadEventEndTiming` Int32,
`NSToDOMContentLoadedTiming` Int32,
`FirstPaintTiming` Int32,
`RedirectCount` Int8,
`SocialSourceNetworkID` UInt8,
`SocialSourcePage` String,
`ParamPrice` Int64,
`ParamOrderID` String,
`ParamCurrency` FixedString(3),
`ParamCurrencyID` UInt16,
`GoalsReached` Array(UInt32),
`OpenstatServiceName` String,
`OpenstatCampaignID` String,
`OpenstatAdID` String,
`OpenstatSourceID` String,
`UTMSource` String,
`UTMMedium` String,
`UTMCampaign` String,
`UTMContent` String,
`UTMTerm` String,
`FromTag` String,
`HasGCLID` UInt8,
`RefererHash` UInt64,
`URLHash` UInt64,
`CLID` UInt32,
`YCLID` UInt64,
`ShareService` String,
`ShareURL` String,
`ShareTitle` String,
`ParsedParams` Nested(
Key1 String,
Key2 String,
Key3 String,
Key4 String,
Key5 String,
ValueDouble Float64),
`IslandID` FixedString(16),
`RequestNum` UInt32,
`RequestTry` UInt8
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(EventDate)
ORDER BY (CounterID, EventDate, intHash32(UserID))
SAMPLE BY intHash32(UserID)

visits_v1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
CREATE TABLE tutorial.visits_v1
(
`CounterID` UInt32,
`StartDate` Date,
`Sign` Int8,
`IsNew` UInt8,
`VisitID` UInt64,
`UserID` UInt64,
`StartTime` DateTime,
`Duration` UInt32,
`UTCStartTime` DateTime,
`PageViews` Int32,
`Hits` Int32,
`IsBounce` UInt8,
`Referer` String,
`StartURL` String,
`RefererDomain` String,
`StartURLDomain` String,
`EndURL` String,
`LinkURL` String,
`IsDownload` UInt8,
`TraficSourceID` Int8,
`SearchEngineID` UInt16,
`SearchPhrase` String,
`AdvEngineID` UInt8,
`PlaceID` Int32,
`RefererCategories` Array(UInt16),
`URLCategories` Array(UInt16),
`URLRegions` Array(UInt32),
`RefererRegions` Array(UInt32),
`IsYandex` UInt8,
`GoalReachesDepth` Int32,
`GoalReachesURL` Int32,
`GoalReachesAny` Int32,
`SocialSourceNetworkID` UInt8,
`SocialSourcePage` String,
`MobilePhoneModel` String,
`ClientEventTime` DateTime,
`RegionID` UInt32,
`ClientIP` UInt32,
`ClientIP6` FixedString(16),
`RemoteIP` UInt32,
`RemoteIP6` FixedString(16),
`IPNetworkID` UInt32,
`SilverlightVersion3` UInt32,
`CodeVersion` UInt32,
`ResolutionWidth` UInt16,
`ResolutionHeight` UInt16,
`UserAgentMajor` UInt16,
`UserAgentMinor` UInt16,
`WindowClientWidth` UInt16,
`WindowClientHeight` UInt16,
`SilverlightVersion2` UInt8,
`SilverlightVersion4` UInt16,
`FlashVersion3` UInt16,
`FlashVersion4` UInt16,
`ClientTimeZone` Int16,
`OS` UInt8,
`UserAgent` UInt8,
`ResolutionDepth` UInt8,
`FlashMajor` UInt8,
`FlashMinor` UInt8,
`NetMajor` UInt8,
`NetMinor` UInt8,
`MobilePhone` UInt8,
`SilverlightVersion1` UInt8,
`Age` UInt8,
`Sex` UInt8,
`Income` UInt8,
`JavaEnable` UInt8,
`CookieEnable` UInt8,
`JavascriptEnable` UInt8,
`IsMobile` UInt8,
`BrowserLanguage` UInt16,
`BrowserCountry` UInt16,
`Interests` UInt16,
`Robotness` UInt8,
`GeneralInterests` Array(UInt16),
`Params` Array(String),
`Goals` Nested(
ID UInt32,
Serial UInt32,
EventTime DateTime,
Price Int64,
OrderID String,
CurrencyID UInt32),
`WatchIDs` Array(UInt64),
`ParamSumPrice` Int64,
`ParamCurrency` FixedString(3),
`ParamCurrencyID` UInt16,
`ClickLogID` UInt64,
`ClickEventID` Int32,
`ClickGoodEvent` Int32,
`ClickEventTime` DateTime,
`ClickPriorityID` Int32,
`ClickPhraseID` Int32,
`ClickPageID` Int32,
`ClickPlaceID` Int32,
`ClickTypeID` Int32,
`ClickResourceID` Int32,
`ClickCost` UInt32,
`ClickClientIP` UInt32,
`ClickDomainID` UInt32,
`ClickURL` String,
`ClickAttempt` UInt8,
`ClickOrderID` UInt32,
`ClickBannerID` UInt32,
`ClickMarketCategoryID` UInt32,
`ClickMarketPP` UInt32,
`ClickMarketCategoryName` String,
`ClickMarketPPName` String,
`ClickAWAPSCampaignName` String,
`ClickPageName` String,
`ClickTargetType` UInt16,
`ClickTargetPhraseID` UInt64,
`ClickContextType` UInt8,
`ClickSelectType` Int8,
`ClickOptions` String,
`ClickGroupBannerID` Int32,
`OpenstatServiceName` String,
`OpenstatCampaignID` String,
`OpenstatAdID` String,
`OpenstatSourceID` String,
`UTMSource` String,
`UTMMedium` String,
`UTMCampaign` String,
`UTMContent` String,
`UTMTerm` String,
`FromTag` String,
`HasGCLID` UInt8,
`FirstVisit` DateTime,
`PredLastVisit` Date,
`LastVisit` Date,
`TotalVisits` UInt32,
`TraficSource` Nested(
ID Int8,
SearchEngineID UInt16,
AdvEngineID UInt8,
PlaceID UInt16,
SocialSourceNetworkID UInt8,
Domain String,
SearchPhrase String,
SocialSourcePage String),
`Attendance` FixedString(16),
`CLID` UInt32,
`YCLID` UInt64,
`NormalizedRefererHash` UInt64,
`SearchPhraseHash` UInt64,
`RefererDomainHash` UInt64,
`NormalizedStartURLHash` UInt64,
`StartURLDomainHash` UInt64,
`NormalizedEndURLHash` UInt64,
`TopLevelDomain` UInt64,
`URLScheme` UInt64,
`OpenstatServiceNameHash` UInt64,
`OpenstatCampaignIDHash` UInt64,
`OpenstatAdIDHash` UInt64,
`OpenstatSourceIDHash` UInt64,
`UTMSourceHash` UInt64,
`UTMMediumHash` UInt64,
`UTMCampaignHash` UInt64,
`UTMContentHash` UInt64,
`UTMTermHash` UInt64,
`FromHash` UInt64,
`WebVisorEnabled` UInt8,
`WebVisorActivity` UInt32,
`ParsedParams` Nested(
Key1 String,
Key2 String,
Key3 String,
Key4 String,
Key5 String,
ValueDouble Float64),
`Market` Nested(
Type UInt8,
GoalID UInt32,
OrderID String,
OrderPrice Int64,
PP UInt32,
DirectPlaceID UInt32,
DirectOrderID UInt32,
DirectBannerID UInt32,
GoodID String,
GoodName String,
GoodQuantity Int32,
GoodPrice Int64),
`IslandID` FixedString(16)
)
ENGINE = CollapsingMergeTree(Sign)
PARTITION BY toYYYYMM(StartDate)
ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID)
SAMPLE BY intHash32(UserID)

导入数据

1
2
clickhouse-client --host clickhouse-server --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv
clickhouse-client --host clickhouse-server --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv

macos

1
2
./clickhouse-macos-aarch64v23.8.9.54   client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < ~/docker/clickhouse/data/hits_v1.tsv
./clickhouse-macos-aarch64v23.8.9.54 client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < ~/docker/clickhouse/data/visits_v1.tsv

比较发现,直接启动的比虚拟机里面的快两个数量级,虚拟机应该是在arm上跑了intel的程序。

查询

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
:) SELECT COUNT(*) FROM tutorial.hits_v1
┌─count()─┐
│ 8873898 │
└─────────┘

1 row in set. Elapsed: 0.005 sec.

:) SELECT COUNT(*) FROM tutorial.visits_v1
Query id: acab693b-3d8d-4c72-8a51-7be2fa68be3a

┌─count()─┐
│ 1680609 │
└─────────┘

1 row in set. Elapsed: 0.042 sec.


:) SELECT
StartURL AS URL,
AVG(Duration) AS AvgDuration
FROM tutorial.visits_v1
WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30'
GROUP BY URL
ORDER BY AvgDuration DESC
LIMIT 10

:) SELECT
sum(Sign) AS visits,
sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits,
(100. * goal_visits) / visits AS goal_percent
FROM tutorial.visits_v1
WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru')

https://builds.clickhouse.com/master/macos-aarch64

20240827-使用rocketmq

1
sudo yum install java-1.8.0-openjdk-devel.x86_64

rocketmq-all-5.1.0-bin-release

运行namesrv

nohup sh mqnamesrv &

修改run broken.sh 添加如下行

1
JAVA_OPT="${JAVA_OPT}  --add-exports=java.base/sun.nio.ch=ALL-UNNAMED"

然后启动broker

1
2
3
4
5
6
7
8
$ sh ./bin/mqbroker -n 172.16.40.24:9876 -c conf/broker.conf
The broker[broker-a, 172.16.40.24:10911] boot success. serializeType=JSON and name server is 192.168.31.99:9876


$ sudo firewall-cmd --zone=public --add-port=9876/tcp --permanent
$ sudo firewall-cmd --zone=public --add-port=10911/tcp --permanent
$ sudo firewall-cmd --reload

通过mqadmin创建 Topic。

1
2
3
4
5
 $ ./bin/mqadmin updateTopic -t TopicTest -c DefaultCluster -n 172.16.40.24:9876
create topic to 192.168.31.99:10911 success.
TopicConfig [topicName=TopicTest, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false, attributes={}]


producer

1
2
3
$ export   NAMESRV_ADDR=172.16.40.24:9876
$ ./bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
$ ./bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer

运行rocketmq-dashboard

docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
version: '3.3'
services:
rocketmq-dashboard:
image: apacherocketmq/rocketmq-dashboard:latest
container_name: rocketmq-dashboard
networks:
- rocketmq
ports:
- 8080:8080
environment:
- JAVA_OPTS=-Drocketmq.namesrv.addr=172.16.40.24:9876
networks:
rocketmq:
driver: bridge

打开防火墙

1
2
$ sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
$ sudo firewall-cmd --reload

minio 学习

minio 172.165.40.4

http://minio-console.haowujidian.com

1
2
accesskey: lOaMW50t9UdiolW3hAHN
secretKey: omDmGbg4qGlQY1ukPzDgH39DncRZf7qNtmC3o9hx

windows下使用mc.exe

http://dl.minio.org.cn/client/mc/release/windows-amd64/mc.exe

1
2
3
4
5
6
7
mc.exe alias set whx http://172.16.40.24:9000 whx Whxheart0210
mc.exe alias set whx http://minio.haowujidian.com whx Whxheart0210

./mc.exe admin info whx
./mc.exe cp --recusive ediplusx64 whx/pubimage/

./mc.exe ls whx/pubimage/

rclone 用于在云存储和本地存储之间的同步、复制

windows:下载地址: https://rclone.org/downloads/

配置文件

C:\Users\whxhe\AppData\Roaming\rclone\rclone.conf

macos:

~/.config/rclone/rclone.conf

1
2
3
4
5
6
7
[whx]
type = s3
provider = Other
env_auth = false
access_key_id = lOaMW50t9UdiolW3hAHN
secret_access_key= omDmGbg4qGlQY1ukPzDgH39DncRZf7qNtmC3o9hx
endpoint = http://minio.haowujidian.com

同步目录

rclone sync d:\soft\whx whx:/pubimage/whx

查看目录

rclone ls whx:\pubimage\whx

centos7服务器安装docker

修改 yum 软件源

1
2
3
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
1
2
3
4
yum update
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2

添加 Docker 稳定版本的 yum 软件源

1
2
3
4
5
6
7
yum-config-manager \
--add-repo \
https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo


sed -i 's+https://download.docker.com+https://mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo

安装 Docker

更新一下 yum 软件源的缓存,并安装 Docker。

1
2
yum update
yum install docker-ce

至此,Docker 已经安装完成了,Docker 服务是没有启动的,操作系统里的 docker 组被创建,但是没有用户在这个组里。

# Install docker-compose

1
2
3
curl -L https://github.com/docker/compose/releases/download/2.29.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

注意

默认的 docker 组是没有用户的(也就是说需要使用 sudo 才能使用 docker 命令)。

您可以将用户添加到 docker 组中(此用户就可以直接使用 docker 命令了)。

加入 docker 用户组命令

1
2
3
whoami
##记录下当前用户名
usermod -a -G docker USERNAME # Add current user to the docker group

启动 Docker

如果想添加到开机启动

1
systemctl enable docker

启动 docker 服务

1
systemctl start docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
update   baseinfo_tb_b_carclass m INNER JOIN (
select brand_id,class_id ,ROW_NUMBER() OVER (PARTITION BY BRAND_ID ORDER BY class_id,class_name) AS sub_index
from baseinfo_tb_b_carclass m1
GROUP BY brand_id ,class_id
order by brand_id,sub_index
) mi
on mi.class_id=m.class_id
set m.show_order=mi.sub_index;




update baseinfo_tb_b_carclass set show_order=10;

update baseinfo_tb_b_carclass m INNER JOIN (
select brand_id,class_id ,ROW_NUMBER() OVER (PARTITION BY BRAND_ID ORDER BY class_id,class_name) AS sub_index
from baseinfo_tb_b_carclass m1
GROUP BY brand_id ,class_id
order by brand_id,sub_index
) mi
on mi.class_id=m.class_id
set m.show_order=mi.sub_index;

select m1.id,m1.dim,m1.dim_real,m1.cal_order,m1.show_order, m1.cal_order + mi.sub_index * POW(100, mi.pow),mi.pow,mi.sub_index,POW(100, mi.pow)
from cem_metrics m1 INNER JOIN (select distinct store , dim, sub_code, sub_index,pow
from cem_metrics m2
where m2.dim like "%_$" and m2.sub_code is not null and m2.sub_code !='0' ) mi
on mi.store=m1.store and mi.dim=m1.dim_root and mi.sub_code = m1.sub_code
where m1.variable=1
and m1.sub_code is not null
and m1.sub_code !='0'
and m1.store = 'nm00012164'
and m1.month=4
and m1.dim like 'REV_YS_FIN_NC_FY_$%';

select m1.id,m1.dim,m1.dim_real,m1.cal_order,m1.show_order, m1.cal_order + mi.sub_index * POW(100, mi.pow),mi.pow,mi.sub_index,POW(100, mi.pow)
from cem_metrics m1 INNER JOIN (select distinct store , dim, sub_code, sub_index,pow
from cem_metrics m2
where m2.dim like "%_$" and m2.sub_code is not null and m2.sub_code !='0' ) mi
on mi.store=m1.store and mi.dim=m1.dim_root and mi.sub_code = m1.sub_code
where m1.variable=1
and m1.sub_code is not null
and m1.sub_code !='0'
and m1.store = 'nm00012164'
and m1.month=6
and m1.dim like 'REV_YS_FIN_NC_FY_%';



update cem_metrics m1 INNER JOIN (select distinct store , dim, sub_code, sub_index,pow
from cem_metrics m2
where m2.dim like "%_$" and m2.sub_code is not null and m2.sub_code !='0' ) mi
on mi.store=m1.store and mi.dim=m1.dim_root and mi.sub_code = m1.sub_code
set m1.show_order=m1.cal_order + mi.sub_index * POW(100, 2)
where m1.variable=1
and m1.sub_code is not null
and m1.sub_code !='0'
and m1.store = 'nm00012164'
and m1.month=4
and m1.dim like 'BAS_NC_INVCNT_DEC_SUB%';


update cem_metrics m
INNER JOIN cem_dim d
on d.code = m.dim
set m.name = d.name,m.cal_order=d.cal_order,m.show_order=d.cal_order,m.dim_parent = d.parent_id
,m.dim_root=d.root_id,m.pow=d.pow,m.variable=d.variable,m.val_type=d.val_type ;


update cem_metrics m INNER JOIN (select store , dim, sub_code,ROW_NUMBER() OVER (PARTITION BY store,dim ORDER BY store,dim) AS sub_index
from cem_metrics m1
where dim like "%_$" and sub_code is not null and sub_code !='0'
GROUP BY store,dim, sub_code
order by store,dim, sub_code) mi
on mi.store=m.store and mi.dim=m.dim and mi.sub_code = m.sub_code
set m.sub_index=mi.sub_index;

update cem_metrics m
INNER JOIN cem_dim dim on dim.code = m.dim and dim.has_sub_detail=1 and dim.sub_detail_type=1
inner join baseinfo_tb_b_carclass c on c.CLASS_CODE =m.sub_code
set m.sub_index =c.show_order;


update cem_metrics set show_order=cal_order;


select m1.id,m1.dim,m1.dim_root,m1.cal_order,m1.pow,mi.cal_order,mi.show_order,CONVERT(mi.show_order + m1.sub_index * POW(100, m1.pow),char)
from cem_metrics m1 INNER JOIN (select distinct store , dim,dim_root, sub_code, sub_index,pow,cal_order,show_order
from cem_metrics m2
where m2.dim like "%_$" and m2.dim_root=m2.dim and m2.sub_code is not null and m2.sub_code !='0' ) mi
on mi.store=m1.store and mi.dim=m1.dim_root and mi.sub_code = m1.sub_code
where m1.variable=1
and m1.dim != m1.dim_root
and m1.dim ='REV_NC_SALE_RETAIL_$_AVG'
and m1.store='nm00012164'
and m1.`month`=6;

update cem_metrics
set show_order=cal_order + sub_index * POW(100, pow)
where dim like "%_$" and dim_root=dim and sub_code is not null and sub_code !='0'
and variable=1;


update cem_metrics m1 INNER JOIN (select distinct store , dim, sub_code, sub_index,pow,cal_order,show_order
from cem_metrics m2
where m2.dim like "%_$" and m2.dim_root=m2.dim and m2.sub_code is not null and m2.sub_code !='0' ) mi
on mi.store=m1.store and mi.dim=m1.dim_root and mi.sub_code = m1.sub_code
set m1.show_order=mi.show_order + m1.sub_index * POW(100, m1.pow)
where m1.variable=1
and m1.dim != m1.dim_root;




update cem_metrics m
set m.show_name = m.name ;


update cem_metrics m
set m.show_name = m.sub_name
where m.dim like "%_$" and m.sub_code !='0' and m.sub_code is not null;

update cem_metrics set dim_real = dim where variable=0;
update cem_metrics set dim_real =replace(dim,"$",sub_code) where variable=1;
update cem_metrics set dim_real_parent = dim_parent where variable=0;
update cem_metrics set dim_real_parent =replace(dim_parent,"$",sub_code) where variable=1;




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
###########定时器(手动复制以下命令执行)############################################
#######每天凌晨执行###########
#crontab -e
#1 0 0 * * ? /data/log/rotate.sh
#systemctl start crond
#systemctl enable crond
###########定时器####################################################################
#/bin/sh: /data/log/rotate.sh: 权限不够
#执行以下命令
#find . -name 'rotate.sh' | xargs chmod 775
##########nginx压缩##################################################################
DATE=$(date +'%Y%m%d%H%M%S')
##########nginx的路径################################################################
nginx_log_path=/data/log/nginx
##########nginx日志备份的路径########################################################
nginx_log_bak_path=/data/log/nginx

mkdir -p $nginx_log_bak_path/$DATE
mv $nginx_log_path/logs/access.log $nginx_log_bak_path/$DATE/access.$DATE.log
mv $nginx_log_path/logs/error.log $nginx_log_bak_path/$DATE/error.$DATE.log
mv $nginx_log_path/logs/dongge-access.log $nginx_log_bak_path/$DATE/dongge-access.$DATE.log
mv $nginx_log_path/logs/dongge-error.log $nginx_log_bak_path/$DATE/dongge-error.$DATE.log
mv $nginx_log_path/logs/newerp-access.log $nginx_log_bak_path/$DATE/newerp-access.$DATE.log
mv $nginx_log_path/logs/newerp-error.log $nginx_log_bak_path/$DATE/newerp-error.$DATE.log
mv $nginx_log_path/logs/olderp-access.log $nginx_log_bak_path/$DATE/olderp-access.$DATE.log
mv $nginx_log_path/logs/olderp-error.log $nginx_log_bak_path/$DATE/olderp-error.$DATE.log
kill -USR1 `cat /var/run/nginx.pid/nginx.pid`
sleep 1
gzip $nginx_log_bak_path/$DATE/access.$DATE.log
gzip $nginx_log_bak_path/$DATE/error.$DATE.log
gzip $nginx_log_bak_path/$DATE/dongge-access.$DATE.log
gzip $nginx_log_bak_path/$DATE/dongge-error.$DATE.log
gzip $nginx_log_bak_path/$DATE/newerp-access.$DATE.log
gzip $nginx_log_bak_path/$DATE/newerp-error.$DATE.log
gzip $nginx_log_bak_path/$DATE/olderp-access.$DATE.log
gzip $nginx_log_bak_path/$DATE/olderp-error.$DATE.log
#########nginx压缩####################################################################

#########删除文件(仅保存180天的备份数据)############################################
find $nginx_log_bak_path -mtime +30 -name "*.log" -exec rm -rf {} \;
################################删除文件##############################################

某次重启服务器后,oracle提示:

ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory

google查询知道 https://stackoverflow.com/questions/6555827/ora-01034-oracle-not-available-ora-27101-shared-memory-realm-does-not-exist

Open command prompt and execute the below commands:

1
2
3
4
5
set oracle_sid=DATABASE NAME
sqlplus /nolog
conn sys/sys as sysdba
shutdown abort
startup

按照上面执行命令后,问题得以解决。