forever杨的个人博客

I want to be forever young!


  • 首页

  • 文章202

  • 分类31

  • 标签175

  • 公益

  • 关于

  • 搜索

Oracle DES 加解密

发表于 2018-12-04 | 更新于 2020-10-09 | 分类于 Oracle
| 字数: 1.5k | 时长 ≈ 1 分钟
标签 DES

DES encrypt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE OR REPLACE FUNCTION DES_ENCRYPT(P_TEXT VARCHAR2, -- 明文。长度要是 8 的倍数,若不足 8 的倍数,则用空白补足
P_KEY VARCHAR2) -- 密钥。长度最少要 8 位以上; 不同的 Key,加密结果将会不同
RETURN VARCHAR2 IS
V_TEXT VARCHAR2(4000); -- 不足 8 的倍数,补足后的字符串
V_ENCRYPT RAW(2048); -- 加密后的字符串
BEGIN
-- 补足。CHR(0) 隐藏字符串
V_TEXT := RPAD(P_TEXT, (TRUNC(LENGTHB(P_TEXT) / 8) + 1) * 8, CHR(0));
V_ENCRYPT := DBMS_OBFUSCATION_TOOLKIT.DESENCRYPT(INPUT => UTL_I18N.STRING_TO_RAW(V_TEXT,
'ZHS16GBK'), -- 转换成 16 进制
KEY => UTL_I18N.STRING_TO_RAW(P_KEY,
'ZHS16GBK')); -- 转换成 16 进制
RETURN RAWTOHEX(V_ENCRYPT);
END;
阅读全文 »

spring-boot shiro 配置

发表于 2018-11-20 | 更新于 2021-04-09 | 分类于 Java
| 字数: 1.1k | 时长 ≈ 1 分钟
标签 spring-boot shiro

初始化

使用@Configuration配置shiro无状态登录时出现的问题,在subject.login之后当前线程重新绑定了一个假定subject,isAuthenticated。

这里自定义的访问拦截器的创建需要放在shiroFilter之后,如下:

阅读全文 »

spring-boot parent

发表于 2018-11-12 | 更新于 2018-12-06 | 分类于 Java
| 字数: 1.4k | 时长 ≈ 1 分钟
标签 spring-boot

End of Life

see:https://spring.io/projects/platform

The Platform will reach the end of its supported life on 9 April 2019. Maintenence releases of both the Brussels and Cairo lines will continue to be published up until that time. Users of the Platform are encourage to start using Spring Boot’s dependency management directory, either by using spring-boot-starter-parent as their Maven project’s parent, or by importing the spring-boot-dependencies bom.

阅读全文 »

Dubbo 多协议配置

发表于 2018-09-18 | 更新于 2019-02-21 | 分类于 Java
| 字数: 2.5k | 时长 ≈ 2 分钟
标签 Apache spring-boot alibaba Dubbo

本文主要阐述,Dubbo 多协议、单协议多端口实现

环境

dubbo 2.6.5、2.7.0

dubbo-spring-boot-starter 0.2.0

多协议实现

在 application.yml 中添加如下配置

首先要开启多协议的配置开关,再通过 protocols 指定多协议

1
2
3
4
5
6
7
8
9
10
11
12
13
14
dubbo:
config:
# 开启多个配置绑定
multiple: true
# 多协议配置
protocols:
dubbo:
name: dubbo
port: 20885
server: netty4
rest:
name: rest
port: 8080
server: netty
阅读全文 »

docker 安装 redis

发表于 2018-09-05 | 分类于 redis
| 字数: 450 | 时长 ≈ 1 分钟
标签 docker docker-compose
  • 拉取镜像

    1
    2
    3
    4
    5
    # 默认拉取 redis:latest 版本
    $ docker pull redis

    # 拉取指定版本镜像
    $ docker pull redis:4.0.11
阅读全文 »

docker 安装 elasticsearch

发表于 2018-09-05 | 更新于 2020-08-21 | 分类于 elk
| 字数: 1.7k | 时长 ≈ 2 分钟
标签 docker docker-compose

elasticsearch

https://www.elastic.co/guide/en/elasticsearch/reference/6.6/docker.html#docker-prod-cluster-composefile

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
version: '3.8'

services:
elasticsearch:
image: elasticsearch:6.6.2
container_name: ts_elasticsearch
ports:
- "9200:9200"
restart: always
volumes:
- "/data/docker/elasticsearch/data:/usr/share/elasticsearch/data"
environment:
- "bootstrap.memory_lock=true"
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- "discovery.type=single-node"
ulimits:
memlock:
soft: -1
hard: -1
networks:
- elknet
networks:
elknet:
driver: bridge

logstash

https://www.elastic.co/guide/en/logstash/6.6/docker-config.html

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
version: '3.8'

services:
logstash:
image: logstash:6.6.2
container_name: ts_logstash
ports:
- "5044:5044"
restart: always
volumes:
- "/data/docker/logstash/pipeline:/usr/share/logstash/pipeline"
- "/data/docker/logstash/config:/usr/share/logstash/config"
environment:
LS_JAVA_OPTS: "-Xmx512m -Xms512m"
networks:
- elknet
depends_on:
- elasticsearch
networks:
elknet:
driver: bridge

kibana

https://www.elastic.co/guide/en/kibana/6.6/docker.html

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
version: '3.8'

services:
kibana:
image: kibana:6.6.2
container_name: ts_kibana
ports:
- 5601:5601
restart: always
volumes:
- "/data/docker/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml"
networks:
- elknet
depends_on:
- elasticsearch
networks:
elknet:
driver: bridge

docker 安装 elk 环境

发表于 2018-09-05 | 更新于 2020-08-21 | 分类于 elk
| 字数: 3.2k | 时长 ≈ 3 分钟
标签 docker docker-compose

安装

从 Docker 仓库中拉取镜像

1
docker pull sebp/elk

拉取指定版本镜像

1
docker pull sebp/elk:671
阅读全文 »

docker 命令

发表于 2018-09-05 | 分类于 docker
| 字数: 1.9k | 时长 ≈ 2 分钟
标签 container

docker container ls

列出所有容器

  • 用法

    1
    docker container ls [options]
阅读全文 »

docker-compose 安装和使用

发表于 2018-09-05 | 更新于 2022-04-02 | 分类于 docker
| 字数: 842 | 时长 ≈ 1 分钟
标签 docker-compose
  1. 安装

    1
    2
    3
    4
    5
    # 注意 docker-compose 版本和 docker 版本有兼容要求
    $ sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose


    $ sudo curl --proxy 192.168.123.1:1234 -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  2. 可执行权限

    1
    $ sudo chmod +x /usr/local/bin/docker-compose
  3. 验证安装

    1
    2
    3
    4
    5
    $ docker-compose --version
    docker-compose version 1.22.0, build 1719ceb

    # 安装后,如果提示 bash: docker-compose: command not found...,则执行一下命令
    $ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
  4. 使用

    1
    $ docker-compose -f grafana/docker-compose.yml up

如果Dockerfile中使用ENTRYPOINT执行启动应用命令,则docker-compose可以使用command和environment指定环境变量

如果Dockerfile中使用CMD执行启动应用命令,则docker-compose不能使用command,需要使用environment指定环境变量

安装 docker 环境

发表于 2018-09-05 | 更新于 2024-02-28 | 分类于 docker
| 字数: 6.2k | 时长 ≈ 6 分钟
标签 docker-compose

安装 Docker

  • 删除旧版本

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    sudo yum remove docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-selinux \
    docker-engine-selinux \
    docker-engine
    # 或者
    sudo yum remove flannel docker* -y
    sudo yum -y remove docker docker-common docker-selinux docker-engine docker-engine-selinux container-selinux docker-ce
    sudo rm -rf /var/lib/docker
阅读全文 »

Indices APIs

发表于 2018-09-04 | 更新于 2019-03-06 | 分类于 elk
| 字数: 2.2k | 时长 ≈ 2 分钟
标签 index

Defines a Template

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
PUT _template/api-monitor
{
"order" : 0,
"index_patterns": [
"api-monitor-*"
],
"settings": {
"index": {
"number_of_shards": 2,
"number_of_replicas": 1,
"refresh_interval": "5s"
}
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"message_field": {
"path_match": "message",
"match_mapping_type": "string",
"mapping": {
"type": "text",
"norms": false
}
}
},
{
"string_fields": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "text",
"norms": false,
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
],
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"type": "keyword"
},
"geoip": {
"dynamic": true,
"properties": {
"ip": {
"type": "ip"
},
"location": {
"type": "geo_point"
},
"latitude": {
"type": "half_float"
},
"longitude": {
"type": "half_float"
}
}
}
}
}
},
"aliases": {}
}

order 默认 0

阅读全文 »

filebeat-6.4.0 使用

发表于 2018-08-30 | 更新于 2019-11-14 | 分类于 elk
| 字数: 729 | 时长 ≈ 1 分钟
标签 filebeat

filebeat 版本 6.6.x

配置输入

1
2
3
4
5
6
7
8
filebeat.inputs:
# 输入类型:[log, stdin, redis, udp, docker, tcp, syslog, netflow]
- type: log
# Change to true to enable this input configuration.
enabled: true
# Paths that should be crawled and fetched. Glob based paths.
paths:
- /var/logs/*.log
阅读全文 »

spring redirect 导致内存溢出问题核查

发表于 2018-08-20 | 更新于 2021-11-20 | 分类于 Java
| 字数: 2.7k | 时长 ≈ 2 分钟
标签 spring redirect

3.x 版本

这个类AbstractCachingViewResolver里面的viewCache HashMap没有限制大小

3.x:如果在 controller 返回的 view 是不固定的,如:”redirect:form.html?entityId=” + entityId,由于 entityId 的值会存在 N 个,那么会导致产生 N 个 ViewName 被缓存起来

阅读全文 »

Java 线程池

发表于 2018-08-17 | 更新于 2018-08-20 | 分类于 Java
| 字数: 1.5k | 时长 ≈ 1 分钟
标签 ExecutorService Executors

线程池作用

  • CPU资源隔离
  • 减少上下文切换
  • 减少线程创建/关闭的资源开销
  • 更好并发控制
  • 更好生命周期控制

设计时注意事项

  • 任务混杂
  • 任务依赖
  • 饥饿死锁
  • 慢操作
阅读全文 »

camel-ftp 使用笔记

发表于 2018-08-09 | 更新于 2021-04-09 | 分类于 Java
| 字数: 2.2k | 时长 ≈ 2 分钟
标签 Apache camel-ftp

解决中文目录乱码问题

1
ftpClient.controlEncoding=gb2312

idempotentConsumer

file

1
2
3
4
5
6
7
8
9
10
11
12
// tmp 是一个路径:./../tmp
// 通过文件名缓存,如果缓存中已经有这个文件名,怎不再处理这个文件
ValueBuilder messageIdExpression = header(Exchange.FILE_PATH)
.append("#").append(header(Exchange.FILE_LAST_MODIFIED))
.append("#").append(header(Exchange.FILE_LENGTH));
FileIdempotentRepository idempotentRepository =
FileIdempotentRepository.fileIdempotentRepository(new File(tmp, this.getClass().getSimpleName() + ".txt"), 100 * 1024, 5 * 1024 * 1024);

from(url.toString())
.idempotentConsumer(messageIdExpression, idempotentRepository)
.process(arrearsProcessor)
.log(LoggingLevel.INFO, log, "finished processor the file ${file:path}.");
阅读全文 »
1…789…14
forever杨

forever杨

开心又过一日,唔开心又过一日

202 文章
31 分类
175 标签
GitHub
友情链接
  • Tidy的个人博客
© 2024 forever杨 | 站点总字数: 706k