之前在測試streamsets 的時候就發現中文亂碼,後邊也每太注意,覺得支持問題,今天跑了下單元
測試代碼,以及使用本機運行,發現都沒有問題,而後運行之前的配置,使用jjs 發現模式的編碼爲
ANSI_X3.4-1968
html
version: "3"
services:
sets:
image: streamsets/datacollector
volumes:
- "./ms/data:/data"
- "./ms/logs:/logs"
- "./ms/tmp:/tmp"
ports:
- "8000:8000"
- "18630:18630"
redis:
image: redis
ports:
- "6379:6379"
mongodb:
image: mongo
ports:
- "27017:27017"
docker-compose exec sets sh
var s = Java.type("java.lang.System")
print(s.getProperty("file.encoding"))
print(s.getProperty("sun.jnu.encoding"))
結果爲上邊說的ANSI_X3.4-1968
java
修改默認編碼爲utf-8git
FROM streamsets/datacollector:3.12.0-latest
ENV SDC_JAVA_OPTS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=utf-8"
ENV SDC_JAVA8_OPTS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=utf-8"
version: "3"
services:
sets:
build: ./
volumes:
- "./ms/data:/data"
- "./ms/logs:/logs"
- "./ms/tmp:/tmp"
ports:
- "8000:8000"
- "18630:18630"
redis:
image: redis
ports:
- "6379:6379"
mongodb:
image: mongo:3.0
ports:
- "27017:27017"
expression 處理
github
mongodb
redis
啓動pipeline很簡單, 點擊start 便可mongodb
curl -i -X POST http://localhost:8000/rest/v1/user --header "X-SDC-APPLICATION-ID:microservice" -d '{"ID":1, "NAME": "Sample Name 榮", "AGE":34, "ADDRESS": "2333 San Francisco"}'
以上處理的方法比較簡單,主要是記錄下一個處理的問題的思路以及解決方法docker
https://streamsets.com/documentation/datacollector/latest/help/datacollector/UserGuide/Configuration/DCEnvironmentConfig.html#concept_rng_qym_qr
https://github.com/streamsets/datacollector-dockerexpress