我试图在3个服务器的复制节点中设置zookeeper.
我的配置文件是这样的
tickTime=2000
dataDir=/var/lib/zookeeper/
clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888
Run Code Online (Sandbox Code Playgroud)
我得到以下异常
QuorumPeer:/0:0:0:0:0:0:0:0:2181:FastLeaderElection@642] - Adding vote
2009-09-23 15:30:28,099 - WARN [WorkerSender Thread:QuorumCnxManager@336] -
Cannot open channel to 3 at election address zoo1/172.21.31.159:3888
java.net.ConnectException: Connection refused at sun.nio.ch.Net.connect(Native Method)> at
sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:
Run Code Online (Sandbox Code Playgroud)
所有端口都是打开的,ssh,telnet也在工作.
谢谢
我需要将多列附加到现有的 spark 数据框,其中列名在 List 中给出,假设新列的值是恒定的,例如给定的输入列和数据框是
val columnsNames=List("col1","col2")
val data = Seq(("one", 1), ("two", 2), ("three", 3), ("four", 4))
Run Code Online (Sandbox Code Playgroud)
并在附加两列后,假设 col1 的常量值为“val1”,col2 的常量值为“val2”,则输出数据帧应为
+-----+---+-------+------+
| _1| _2|col1 |col2|
+-----+---+-------+------+
| one| 1|val1 |val2|
| two| 2|val1 |val2|
|three| 3|val1 |val2|
| four| 4|val1 |val2|
+-----+---+-------+------+
Run Code Online (Sandbox Code Playgroud)
我写了一个函数来追加列
def appendColumns (cols: List[String], ds: DataFrame): DataFrame = {
cols match {
case Nil => ds
case h :: Nil => appendColumns(Nil, ds.withColumn(h, lit(h)))
case h :: tail => appendColumns(tail, ds.withColumn(h, lit(h)))
}
}
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法和更实用的方法来做到这一点。 …
我在红移谱中创建了一个外部表。运行 select * from table_name 后,我收到以下错误
SQL Error [XX000]: ERROR: Spectrum Scan Error
Detail:
-----------------------------------------------
error: Spectrum Scan Error
code: 15007
context: Forbidden: HTTP response error code: 403 Message: AccessDenied Access Denied
Run Code Online (Sandbox Code Playgroud)
请让我知道可能出现什么问题。我可以在同一 s3 位置执行 aws s3 ls 和 aws s3 cp 命令。
amazon-web-services amazon-redshift amazon-redshift-spectrum
我必须使用logstash在elasticsearch中创建自定义索引.我已创建在elasticsearch新的模板,并且在logstash配置我有指定模板路径,TEMPLATE_NAME和template_overwrite值,但仍然每当我运行logstash,与logstash-DD-MM-YY的正则表达式生成的新的索引,而不是与在属性中指定TEMPLATE_NAME ,logstash -config文件是
input {
file {
path => "/temp/file.txt"
type => "words"
start_position => "beginning"
}
}
filter {
mutate {
add_field => {"words" => "%{message}"}
}
}
output {
elasticsearch {
hosts => ["elasticserver:9200"]
template => "pathtotemplate.json"
template_name => "newIndexName-*"
template_overwrite => true
}
stdout{}
}
Run Code Online (Sandbox Code Playgroud)
索引模板文件是
{
"template": "dictinary-*",
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index" : {
"query" : { "default_field" : "@words" },
"store" : { "compress" : { "stored" : true, …Run Code Online (Sandbox Code Playgroud) 我已经使用spark-thriftserver jdbc连接将表从PostgreSQL数据库导入到spark-sql中,现在从beeline中可以看到这些表。
有什么办法可以将这些表转换为Spark数据框架。