云服务器内容精选

  • 对接步骤 配置Druid。 修改配置: conf/druid/single-server/micro-quickstart/_common/common.runtime.properties 将druid-hdfs-storage加入druid.extensions.loadList。 配置Deep storage在OBS中的存储路径。 配置OBSA-HDFS插件。 在官方Github下载OBSA-HDFS插件:下载地址,然后拷贝到extensions/druid-hdfs-storage/ 目录。 在配置目录conf/druid/single-server/micro-quickstart/_common/下增加hdfs-site.xml,配置如下(其中endpoint按照桶所在的实际endpoint填写): 启动Druid服务。
  • 对接步骤 以logstash-7.10.2为例。 下载logstash-7.10.2-linux-x86_64.tar.gz,并解压到/opt/logstash-7.10.2-linux-x86_64目录。 验证是否对接成功。 示例:以file为源端,以OBS为目的端。 创建配置文件file2obs.conf。参数说明见表1,更多详情请参见这里。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "input": { "file": { "path" : "/opt/nginx/logs/access.log", "start_position" : "beginning" } }, "output": { "s3": { "endpoint" : "obs endpoint",, "bucket" : "obs桶名", "access_key_id" : "ak", "secret_access_key" : "sk", "size_file" : 1048576, "time_file" : 1, "prefix" : "logstash/", "enable_metric" : true } } } 表1 参数说明 参数 说明 endpoint OBS的endpoint,例如 https://obs.cn-north-4.myhuaweicloud.com http://obs.cn-north-4.myhuaweicloud.com access_key_id 具备访问OBS权限的ak。 secret_access_key 具备访问OBS权限的sk。 bucket OBS的桶名称。 size_file 指定文件滚动大小(字节)。当文件大小达到设定的值时,会生成一个新的文件。 time_file 设置文件滚动周期(分钟)。当数据写入达到设定周期时,会生成一个新的文件。 prefix 指定文件存储的目录,例如“logstash/”,此时文件会写入到桶的logstash/目录下(注意路径不要以/开头)。 执行以下命令,运行logstash。 bin/logstash -f ../conf/file2obs.conf
  • 对接步骤 以Spark2.3.3为例。 下载spark-2.3.3-bin-without-hadoop.tgz,并解压到/opt/spark-2.3.3。 在/etc/profile文件中增加配置内容: export SPARK_HOME=/opt/spark-2.3.3export PATH=$SPARK_HOME/bin:$SPARK_HOME/sbin:$PATH 配置spark。 重命名/opt/spark-2.3.3/conf/spark-env.sh.template为spark-env.sh并增加配置: export SPARK_DIST_CLASSPATH=$(hadoop classpath) 更多配置内容请参见Apache Hadoop。 重命名/opt/spark-2.3.3/conf/log4j.properties.template为log4j.properties。 执行以下命令,验证是否对接成功。 $SPARK_HOME/bin/run-example org.apache.spark.examples.JavaWordCount obs://obs-bucket/input/test.txt