Java项目中各种配置文件的写法(示例)

日志文件log4j.properties

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Set everything to be logged to the console
log4j.rootCategory=FATAL, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n

# Settings to quiet third party logs that are too verbose
log4j.logger.org.spark-project.jetty=WARN
log4j.logger.org.spark-project.jetty.util.component.AbstractLifeCycle=ERROR
log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFO
log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFO

# SPARK-9183: Settings to avoid annoying messages when looking up nonexistent UDFs in SparkSQL with Hive support
log4j.logger.org.apache.hadoop.hive.metastore.RetryingHMSHandler=FATAL
log4j.logger.org.apache.hadoop.hive.ql.exec.FunctionRegistry=ERROR

application.conf配置文件

#配置spark相关的参数
spark.worker.timeout="500"
spark.rpc.askTimeout="600s"
spark.network.timeout="600s"
spark.cores.max="10"
spark.task.maxFailures="5"
spark.speculation="true"
spark.driver.allowMutilpleContext="true"
spark.serializer="org.apache.spark.serializer.KryoSerializer"
spark.buffer.pageSize="8m"

#指定文件路径
data.path="src/main/resources/data.json"

#指定解析ip信息的数据字典文件
GeoLiteCityDat="src/main/resources/GeoLiteCity.dat"
qqwryDat="src/main/resources/qqwry.dat"
installDir="src/main/resources"

#指定ods表的前缀
ods.prefix="ODS"

#配置数据字典文件路径
appIDName="src/main/resources/appID_name"
devicedic="src/main/resources/devicedic"

#定义impala的连接url地址
impala.url="jdbc:impala://node1:21050/default"

#配置标签数据的表的前缀
tags.prefix="TP"

#配置标签衰减系数
tags.coffee="0.92"

#配置es集群的相关信息
cluster.name="myes"
esNodes="node1"

conf.properties配置文件

url = jdbc:mysql://localhost:3306/your_database_name
username = root
password = root
driver = com.mysql.jdbc.Driver

XML配置文件

<?xml version="1.0" encoding="UTF-8"?>

<!--Autogenerated by Cloudera Manager-->
<configuration>
  <property>
    <name>hive.metastore.uris</name>
    <value>thrift://bigdata-m-003.bigdata.com:9083</value>
  </property>
  <property>
    <name>hive.metastore.client.socket.timeout</name>
    <value>300</value>
  </property>
  <property>
    <name>hive.metastore.warehouse.dir</name>
    <value>/user/hive/warehouse</value>
  </property>
</configuration>
发布了68 篇原创文章 · 获赞 4 · 访问量 7398

猜你喜欢

转载自blog.csdn.net/weixin_44455388/article/details/102890601
今日推荐