我试图将一个MSSQL数据库的内容提供给第二个MSSQL数据库.不需要冲突管理,也不需要更新架构.它只是一个简单的副本并替换数据.目标数据库的数据将被覆盖,以防有人在那里改变了某些东西.
显然,有很多方法可以做到这一点
当然,在微软网站上看时,我读到每种技术(当然除了蛮力)都被认为是一种可以在许多场景中应用的可靠解决方案.但那当然不是我想听的东西.
那你对此有何看法?你会建议哪种技术?
谢谢!
斯特凡
我打开火花壳
spark-shell --packages org.apache.spark:spark-streaming-kafka_2.10:1.6.0
Run Code Online (Sandbox Code Playgroud)
然后我想创建一个流上下文
import org.apache.spark._
import org.apache.spark.streaming._
val conf = new SparkConf().setMaster("local[2]").setAppName("NetworkWordCount").set("spark.driver.allowMultipleContexts", "true")
val ssc = new StreamingContext(conf, Seconds(1))
Run Code Online (Sandbox Code Playgroud)
我遇到了一个例外:
org.apache.spark.SparkException: Only one SparkContext may be running in this JVM (see SPARK-2243). To ignore this error, set spark.driver.allowMultipleContexts = true. The currently running SparkContext was created at:
Run Code Online (Sandbox Code Playgroud) 我尝试在 Zeppelin 中使用 dep 解释器。
我在我的 zeppelin 笔记本中使用了 %dep 声明。
但是,我最终得到了错误“找不到 dep 解释器”
我尝试在Apache Zeppelin中运行以下简单命令.
%flink
var rabbit = env.fromElements(
"ARTHUR: What, behind the rabbit?",
"TIM: It is the rabbit!",
"ARTHUR: You silly sod! You got us all worked up!",
"TIM: Well, that's no ordinary rabbit. That's the most foul, cruel, and bad-tempered rodent you ever set eyes on.",
"ROBIN: You tit! I soiled my armor I was so scared!",
"TIM: Look, that rabbit's got a vicious streak a mile wide, it's a killer!")
var counts = rabbit.flatMap { _.toLowerCase.split("\\W+")}.map{ (_,1)}.groupBy(0).sum(1)
counts.print()
Run Code Online (Sandbox Code Playgroud)
我尝试在笔记本中打印出结果.但不幸的是,我只得到以下输出. …
我尝试将以下字符串连接到路径
mr = "/mapr"
cn = "12.12.12"
lp = "/data/dir/"
vin = "var"
os.path.join(mr, cn, lp, vin)
Run Code Online (Sandbox Code Playgroud)
导致
'/data/dir/var'
Run Code Online (Sandbox Code Playgroud)
为了达到预期的结果,我需要删除变量lp中的第一个正斜杠
lp = "data/dir/"
os.path.join(mr, cn, lp, vin)
'/mapr/12.12.12/data/dir/var'
Run Code Online (Sandbox Code Playgroud)
有没有更优雅的做法,因为我不想在开始时解析转发斜杠的所有标识符?
我有一个应用程序,可以让我选择是使用线程还是进程:
def _get_future(self, workers):
if self.config == "threadpool":
self.logger.debug("using thread pools")
executor = ThreadPoolExecutor(max_workers=workers)
else:
self.logger.debug("using process pools")
executor = ProcessPoolExecutor(max_workers=workers)
return executor
Run Code Online (Sandbox Code Playgroud)
后来我执行代码:
self.executor = self._get_future()
for component in components:
self.logger.debug("submitting {} to future ".format(component))
self.future_components.append(self.executor.submit
(self._send_component, component))
# Wait for all tasks to finish
while self.future_components:
self.future_components.pop().result()
Run Code Online (Sandbox Code Playgroud)
当我使用进程时,我的应用程序会卡住。_send_component 方法永远不会被调用。当我使用线程时一切正常。
我在Teradata有一张桌子.我想知道它的大小.对Teradata中的数据库来说,同样的事情可能会很有趣.
我该怎么做?
我打算在客户端和服务器之间使用 SSH 密钥创建使用无密码连接。
使用 paramiko,我最终遇到AuthenticationException。通过 Popen 使用标准 SSH,我可以毫无问题地连接
对于 Paramiko,我使用以下代码:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.load_system_host_keys()
client.connect(ssh_server, username=ssh_user)
Run Code Online (Sandbox Code Playgroud)
对于同样的情况,我可以使用 SSH:
cmd = 'ssh -o GSSAPIAuthentication=no -o ForwardX11=no {}@{} echo 0 > /dev/null'.format(ssh_user, ssh_server)
process = subprocess.Popen(md, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
process.communicate()
Run Code Online (Sandbox Code Playgroud)
我正在使用 Python 3.4.6 和 Paramiko 2.4.1。
更多细节:
Paramiko 调试输出
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.load_system_host_keys()
client.connect(ssh_server, username=ssh_user)
Run Code Online (Sandbox Code Playgroud)
SSH 调试:(使用 ssh -v ssh_user AT ssh_server)
cmd = 'ssh -o GSSAPIAuthentication=no -o ForwardX11=no {}@{} echo 0 > …Run Code Online (Sandbox Code Playgroud) 我可以将 p12 密钥库导入到密钥库。通过 storepass,我可以预先填写目标密钥库的密码。
keytool -importkeystore -srckeystore kafka.server.keystore.p12 -srcstoretype pkcs12 -destkeystore kafka.server.keystore.jks -storepass $PWD
Run Code Online (Sandbox Code Playgroud)
但是,仍然要求我提供源密钥库密码:
Enter source keystore password:
Run Code Online (Sandbox Code Playgroud)
我该如何防止这种情况发生?
python ×2
apache-flink ×1
apache-spark ×1
bash ×1
database ×1
hadoop ×1
java ×1
keytool ×1
paramiko ×1
python-3.x ×1
sql-server ×1
ssh ×1
teradata ×1