Browse Source
* commit 'a3926e8a46faee5970b7eaf8f816951871b13a02': update readme.md edited online with Bitbucket readme.md edited online with Bitbucket update REPORT-10696 HDFS插件release/10.0
rinoux
6 years ago
13 changed files with 323 additions and 105 deletions
After Width: | Height: | Size: 268 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 33 KiB |
@ -1,32 +1,8 @@
|
||||
# 开发和测试使用说明 |
||||
- 1、hdfs仓库插件是平台文件服务器的扩展,首先需要正常方式安装插件; |
||||
- 2、在没有平台可视化设置之前,可以通过添加数据库字段来开启hdfs; |
||||
> 在fine_conf_entity添加HDFS的仓库配置: |
||||
![字段](./img/db_fields.png) |
||||
> 图中的`ResourceModuleConfig.profiles.HDFS_TEST.workroots.[你的机器id(可以拷贝表中LOCAL_ENV的)]`为hdfs的工作路径。 |
||||
- 安装插件; |
||||
- 进入平台,管理系统/智能运维/集群配置/文件服务器; |
||||
- 选择HDFS协议,添加主机、端口等配置,如果设置了kerberos认证,还需要设置principal和keyTab文件路径。以及文件服务器在hdfs上的工作路径; |
||||
- 测试连接并保存; |
||||
|
||||
> `host`设置为Hadoop的hdfs地址,比如默认localhost,`port`为hdfs端口(默认9000)。 |
||||
|
||||
> 如果有用户组设置还需要对应用户名 `username`。 |
||||
|
||||
|
||||
> 在fine_conf_entity添加数据库字段设置仓库为hdfs: |
||||
![设置](./img/set.png) |
||||
|
||||
|
||||
> 在fine_conf_classname: |
||||
添加 |
||||
![profile](./img/class_fields.png) |
||||
- 3、启动设计器或者平台 |
||||
|
||||
- 4、其它说明: |
||||
|
||||
改数据库太麻烦,可以直接在适当的地方(比如com.fr.io.ResourceRepositoryActivator.doExtra()方法末尾)添加代码 |
||||
``` Map<String, Object> hdfsConfig = new HashMap<String, Object>(); |
||||
hdfsConfig.put("host", "localhost"); |
||||
hdfsConfig.put("port", 9000); |
||||
try { |
||||
ProfileFactory.create("HDFS", "HDFS_TEST", "/app", true, hdfsConfig).install().apply(); |
||||
} catch (RepositoryException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
>> 示例 |
||||
![demo](demo.png) |
||||
|
@ -0,0 +1,18 @@
|
||||
package com.fr.plugin.hdfs.repository.decision; |
||||
|
||||
import com.fr.web.struct.Component; |
||||
import com.fr.web.struct.browser.RequestClient; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
|
||||
/** |
||||
* Created by rinoux on 2018/11/26. |
||||
*/ |
||||
public class HDFSFileServerComponent extends Component { |
||||
public static HDFSFileServerComponent KEY = new HDFSFileServerComponent(); |
||||
|
||||
|
||||
@Override |
||||
public ScriptPath script(RequestClient req) { |
||||
return ScriptPath.build("com/fr/plugin/hdfs/repository/decision/js/bundle.js"); |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.plugin.hdfs.repository.decision; |
||||
|
||||
import com.fr.decision.fun.SystemOptionProvider; |
||||
import com.fr.decision.fun.impl.AbstractSystemOptionProvider; |
||||
import com.fr.decision.web.MainComponent; |
||||
import com.fr.stable.fun.mark.API; |
||||
import com.fr.web.struct.Atom; |
||||
|
||||
/** |
||||
* Created by rinoux on 2018/11/26. |
||||
*/ |
||||
@API(level = SystemOptionProvider.CURRENT_LEVEL) |
||||
public class HDFSFileServerOption extends AbstractSystemOptionProvider { |
||||
@Override |
||||
public String id() { |
||||
return "hdfs_file_server"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public int sortIndex() { |
||||
return 2; |
||||
} |
||||
|
||||
@Override |
||||
public Atom attach() { |
||||
return MainComponent.KEY; |
||||
} |
||||
|
||||
@Override |
||||
public Atom client() { |
||||
return HDFSFileServerComponent.KEY; |
||||
} |
||||
} |
@ -0,0 +1,179 @@
|
||||
BI.config("dec.constant.intelligence.cluster.file.server", function (items) { |
||||
items.push({ |
||||
value: "HDFS", // 地址栏显示的hash值
|
||||
id: "decision-intelligence-cluster-file-hdfs", // id
|
||||
text: BI.i18nText(""), // 文字
|
||||
cardType: "dec.intelligence.cluster.file.hdfs", |
||||
}); |
||||
return items; |
||||
}); |
||||
|
||||
|
||||
!(function () { |
||||
var LABEL_WIDTH = 116, EDITOR_WIDTH = 300; |
||||
var HDFS = BI.inherit(BI.Widget, { |
||||
|
||||
props: { |
||||
baseCls: "dec-cluster-ftp", |
||||
value: {} |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dec.model.intelligence.cluster.file.hdfs", { |
||||
value: this.options.value |
||||
}); |
||||
}, |
||||
|
||||
watch: {}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "bi.vertical", |
||||
tgap: 15, |
||||
items: [ |
||||
{ |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
textWidth: LABEL_WIDTH, |
||||
editorWidth: EDITOR_WIDTH, |
||||
watermark: BI.i18nText("Dec-Please_Input"), |
||||
text: BI.i18nText("Dec-Basic_Host"), |
||||
value: this.model.host, |
||||
ref: function (_ref) { |
||||
self.hostRow = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setHost(this.getValue()); |
||||
} |
||||
}] |
||||
}, { |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
textWidth: LABEL_WIDTH, |
||||
editorWidth: EDITOR_WIDTH, |
||||
watermark: BI.i18nText("Dec-Please_Input"), |
||||
text: BI.i18nText("Dec-Server_Port"), |
||||
value: this.model.port, |
||||
ref: function (_ref) { |
||||
self.portRow = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setPort(this.getValue()); |
||||
} |
||||
}] |
||||
}, |
||||
{ |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
textWidth: LABEL_WIDTH, |
||||
editorWidth: EDITOR_WIDTH, |
||||
watermark: BI.i18nText("Principal"), |
||||
text: BI.i18nText("Principal"), |
||||
value: this.model.principal, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setPrincipal(this.getValue()); |
||||
} |
||||
}] |
||||
}, |
||||
{ |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
textWidth: LABEL_WIDTH, |
||||
editorWidth: EDITOR_WIDTH, |
||||
watermark: BI.i18nText("keyTab文件路径"), |
||||
text: BI.i18nText("keyTab"), |
||||
value: this.model.keyTab, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setKeyTab(this.getValue()); |
||||
} |
||||
}] |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return { |
||||
host: this.model.host, |
||||
port: BI.parseInt(this.model.port), |
||||
principal: this.model.principal, |
||||
keyTab: this.model.keyTab |
||||
}; |
||||
}, |
||||
|
||||
validation: function () { |
||||
var valid = true, host = this.model.host, port = this.model.port; |
||||
if (!(/^[a-zA-Z0-9._-]+(\.[a-zA-Z]{2,6})?$/.test(host))) { |
||||
this.hostRow.showError(BI.i18nText("Dec-Error_Format")); |
||||
valid = false; |
||||
} |
||||
if (BI.isEmpty(host)) { |
||||
this.hostRow.showError(BI.i18nText("Dec-Error_Null")); |
||||
valid = false; |
||||
} |
||||
if (!(/^[0-9]+$/.test(port))) { |
||||
this.portRow.showError(BI.i18nText("Dec-Error_Format")); |
||||
valid = false; |
||||
} |
||||
if (BI.isEmptyString(port)) { |
||||
this.portRow.showError(BI.i18nText("Dec-Error_Null")); |
||||
valid = false; |
||||
} |
||||
return valid; |
||||
} |
||||
}); |
||||
BI.shortcut("dec.intelligence.cluster.file.hdfs", HDFS); |
||||
})(); |
||||
|
||||
|
||||
!(function () { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
|
||||
state: function () { |
||||
var val = this.options.value; |
||||
return { |
||||
host: val.host, |
||||
port: val.port, |
||||
principal: val.principal, |
||||
keyTab: val.keyTab |
||||
}; |
||||
}, |
||||
|
||||
computed: { |
||||
encodingArray: function () { |
||||
return BI.map(DecCst.EncodeConstants.ENCODING_ARRAY, function (i, v) { |
||||
return { |
||||
value: v |
||||
}; |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
setHost: function (v) { |
||||
this.model.host = v; |
||||
}, |
||||
|
||||
setPort: function (v) { |
||||
this.model.port = v; |
||||
}, |
||||
|
||||
setPrincipal: function (v) { |
||||
this.model.principal = v; |
||||
}, |
||||
|
||||
setKeyTab: function (v) { |
||||
this.model.keyTab = v; |
||||
} |
||||
} |
||||
}); |
||||
BI.model("dec.model.intelligence.cluster.file.hdfs", Model); |
||||
})(); |
Loading…
Reference in new issue