大数据开发技术Scala/sql进入方法总结

大数据开发技术Scala/sql进入方法总结
启动Scala-Shell

start-all.sh

大数据开发技术Scala/sql进入方法总结

jps

大数据开发技术Scala/sql进入方法总结

cd hadoop-2.9.2/

大数据开发技术Scala/sql进入方法总结

sbin/start-all.sh

大数据开发技术Scala/sql进入方法总结

cd spark-2.4.2-bin-hadoop2.7/

大数据开发技术Scala/sql进入方法总结

大数据开发技术Scala/sql进入方法总结

大数据开发技术Scala/sql进入方法总结

大数据开发技术Scala/sql进入方法总结

'abrt-cli status' timed out
[mls@master ~]$ ls
20171024                apache-tomcat-9.0.20  eclipse            idea-IC-191.7141.44          Public                      sparktestdata                  Templates
20171024_reduced        core.11499            eclipse-workspace  IdeaProjects                 pycharm-community-2019.2.4  sqoop-1.4.7.bin__hadoop-2.6.0  Videos
anaconda3               Desktop               flume_spool        Music                        PycharmProjects             stockproject_data
apache-flume-1.8.0-bin  Documents             hadoop-2.9.2       mysql-connector-java-5.1.47  scala-2.12.8                stocksql
apache-hive-2.3.4-bin   Downloads             hadoopdata         Pictures                     spark-2.4.2-bin-hadoop2.7   table1_data.txt
[mls@master ~]$ start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [master]
master: starting namenode, logging to /home/mls/hadoop-2.9.2/logs/hadoop-mls-namenode-master.out
master: starting datanode, logging to /home/mls/hadoop-2.9.2/logs/hadoop-mls-datanode-master.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /home/mls/hadoop-2.9.2/logs/hadoop-mls-secondarynamenode-master.out
starting yarn daemons
starting resourcemanager, logging to /home/mls/hadoop-2.9.2/logs/yarn-mls-resourcemanager-master.out
master: starting nodemanager, logging to /home/mls/hadoop-2.9.2/logs/yarn-mls-nodemanager-master.out
[mls@master ~]$ jps
11701 DataNode
12262 NodeManager
11576 NameNode
12122 ResourceManager
11900 SecondaryNameNode
12557 Jps
[mls@master ~]$ cd hadoop-2.9.2/
[mls@master hadoop-2.9.2]$ sbin/start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [master]
master: namenode running as process 11576. Stop it first.
master: datanode running as process 11701. Stop it first.
Starting secondary namenodes [0.0.0.0]
0.0.0.0: secondarynamenode running as process 11900. Stop it first.
starting yarn daemons
resourcemanager running as process 12122. Stop it first.
master: nodemanager running as process 12262. Stop it first.
[mls@master hadoop-2.9.2]$ cd
[mls@master ~]$ cd spark-2.4.2-bin-hadoop2.7/
[mls@master spark-2.4.2-bin-hadoop2.7]$ ./bin/spark-submit 
Usage: spark-submit [options] <app jar | python file | R file> [app arguments]
Usage: spark-submit --kill [submission ID] --master [spark://...]
Usage: spark-submit --status [submission ID] --master [spark://...]
Usage: spark-submit run-example [options] example-class [example args]

Options:
  --master MASTER_URL         spark://host:port, mesos://host:port, yarn,
                              k8s://https://host:port, or local (Default: local[*]).
  --deploy-mode DEPLOY_MODE   Whether to launch the driver program locally ("client") or
                              on one of the worker machines inside the cluster ("cluster")
                              (Default: client).
  --class CLASS_NAME          Your application's main class (for Java / Scala apps).
  --name NAME                 A name of your application.
  --jars JARS                 Comma-separated list of jars to include on the driver
                              and executor classpaths.
  --packages                  Comma-separated list of maven coordinates of jars to include
                              on the driver and executor classpaths. Will search the local
                              maven repo, then maven central and any additional remote
                              repositories given by --repositories. The format for the
                              coordinates should be groupId:artifactId:version.
  --exclude-packages          Comma-separated list of groupId:artifactId, to exclude while
                              resolving the dependencies provided in --packages to avoid
                              dependency conflicts.
  --repositories              Comma-separated list of additional remote repositories to
                              search for the maven coordinates given with --packages.
  --py-files PY_FILES         Comma-separated list of .zip, .egg, or .py files to place
                              on the PYTHONPATH for Python apps.
  --files FILES               Comma-separated list of files to be placed in the working
                              directory of each executor. File paths of these files
                              in executors can be accessed via SparkFiles.get(fileName).

  --conf PROP=VALUE           Arbitrary Spark configuration property.
  --properties-file FILE      Path to a file from which to load extra properties. If not
                              specified, this will look for conf/spark-defaults.conf.

  --driver-memory MEM         Memory for driver (e.g. 1000M, 2G) (Default: 1024M).
  --driver-java-options       Extra Java options to pass to the driver.
  --driver-library-path       Extra library path entries to pass to the driver.
  --driver-class-path         Extra class path entries to pass to the driver. Note that
                              jars added with --jars are automatically included in the
                              classpath.

  --executor-memory MEM       Memory per executor (e.g. 1000M, 2G) (Default: 1G).

  --proxy-user NAME           User to impersonate when submitting the application.
                              This argument does not work with --principal / --keytab.

  --help, -h                  Show this help message and exit.
  --verbose, -v               Print additional debug output.
  --version,                  Print the version of current Spark.

 Cluster deploy mode only:
  --driver-cores NUM          Number of cores used by the driver, only in cluster mode
                              (Default: 1).

 Spark standalone or Mesos with cluster deploy mode only:
  --supervise                 If given, restarts the driver on failure.
  --kill SUBMISSION_ID        If given, kills the driver specified.
  --status SUBMISSION_ID      If given, requests the status of the driver specified.

 Spark standalone and Mesos only:
  --total-executor-cores NUM  Total cores for all executors.

 Spark standalone and YARN only:
  --executor-cores NUM        Number of cores per executor. (Default: 1 in YARN mode,
                              or all available cores on the worker in standalone mode)

 YARN-only:
  --queue QUEUE_NAME          The YARN queue to submit to (Default: "default").
  --num-executors NUM         Number of executors to launch (Default: 2).
                              If dynamic allocation is enabled, the initial number of
                              executors will be at least NUM.
  --archives ARCHIVES         Comma separated list of archives to be extracted into the
                              working directory of each executor.
  --principal PRINCIPAL       Principal to be used to login to KDC, while running on
                              secure HDFS.
  --keytab KEYTAB             The full path to the file that contains the keytab for the
                              principal specified above. This keytab will be copied to
                              the node running the Application Master via the Secure
                              Distributed Cache, for renewing the login tickets and the
                              delegation tokens periodically.
      
[mls@master spark-2.4.2-bin-hadoop2.7]$ cd
[mls@master ~]$ cd hadoop-2.9.2/
[mls@master hadoop-2.9.2]$ cd ~/spark-2.4.2-bin-hadoop2.7/bin/
[mls@master bin]$ ./spark-shell --master yarn
20/12/12 02:29:45 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
20/12/12 02:29:57 WARN Client: Neither spark.yarn.jars nor spark.yarn.archive is set, falling back to uploading libraries under SPARK_HOME.
Spark context Web UI available at http://master:4040
Spark context available as 'sc' (master = yarn, app id = application_1607710614793_0001).
Spark session available as 'spark'.
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /___/ .__/\_,_/_/ /_/\_\   version 2.4.2
      /_/
         
Using Scala version 2.12.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_191)
Type in expressions to have them evaluated.
Type :help for more information.

scala> 

启动SQL

[mls@master bin]$ cd
[mls@master ~]$ cd hadoop-2.9.2/
[mls@master hadoop-2.9.2]$ 
[mls@master hadoop-2.9.2]$ sbin/start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [master]
master: namenode running as process 11576. Stop it first.
master: datanode running as process 11701. Stop it first.
Starting secondary namenodes [0.0.0.0]
0.0.0.0: secondarynamenode running as process 11900. Stop it first.
starting yarn daemons
resourcemanager running as process 12122. Stop it first.
master: nodemanager running as process 12262. Stop it first.
[mls@master hadoop-2.9.2]$ cd ~/spark-2.4.2-bin-hadoop2.7/bin/
[mls@master bin]$ ./spark-sql --master yarn
20/12/12 02:39:18 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
20/12/12 02:39:18 WARN HiveConf: HiveConf of name hive.metastore.local does not exist
Sat Dec 12 02:39:19 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sat Dec 12 02:39:19 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sat Dec 12 02:39:19 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sat Dec 12 02:39:19 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
20/12/12 02:39:19 WARN HiveConf: HiveConf of name hive.metastore.local does not exist
Sat Dec 12 02:39:20 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sat Dec 12 02:39:20 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sat Dec 12 02:39:20 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sat Dec 12 02:39:20 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
20/12/12 02:39:23 WARN Client: Neither spark.yarn.jars nor spark.yarn.archive is set, falling back to uploading libraries under SPARK_HOME.
Spark master: yarn, Application Id: application_1607710614793_0002
spark-sql> show databeses;
Error in query: 
missing 'FUNCTIONS' at '<EOF>'(line 1, pos 14)

== SQL ==
show databeses
--------------^^^

spark-sql> show databases;
default
stock
stock_1
stock_4
Time taken: 0.957 seconds, Fetched 4 row(s)
spark-sql> 

大数据开发技术Scala/sql进入方法总结

大数据开发技术Scala/sql进入方法总结

大数据开发技术Scala/sql进入方法总结

[mls@master bin]$ cat /user/mls/.sparkStaging/application_1607706329173_0001/__spark_libs__2394901264014099355.zip
cat: /user/mls/.sparkStaging/application_1607706329173_0001/__spark_libs__2394901264014099355.zip: No such file or directory
[mls@master bin]$ cat /user/hive/warehouse/stock_4.db/clean_data/part-00196-83ec44ca-8a13-4e1a-ad78-96ecd9eba01b-c000
cat: /user/hive/warehouse/stock_4.db/clean_data/part-00196-83ec44ca-8a13-4e1a-ad78-96ecd9eba01b-c000: No such file or directory
[mls@master bin]$ hdfs dfs -cat /user/hive/warehouse/stock_4.db/clean_data/part-00196-83ec44ca-8a13-4e1a-ad78-96ecd9eba01b-c000




0000011202222380.52403.592404.442374.031.18684272E8
0000011303042332.082273.42333.542259.251.61750032E8
0000011309102214.812237.982238.552202.822.37206656E8
0000011310092191.392211.772212.352185.181.30871736E8
0000011403072058.382057.912079.492050.471.03709536E8
0000011504244355.954393.694416.384318.126.2855501E8
0000011507063975.213775.913975.213653.048.3113926E8
0000011604143080.093082.363086.73056.992.08237824E8
0000011608113013.683002.643038.053001.171.61879488E8
0000011608123000.273050.673051.052999.041.68173664E8
6000001201179.09.29.268.79973572.0
6000001205109.219.169.249.11675762.0
6000001212148.328.98.998.323443944.0
6000001212289.379.599.649.371195998.0
6000001308057.988.068.077.95530561.0
6000001408219.649.59.659.431180571.0
60000015010715.915.8116.1715.533857168.0
60000016120217.117.117.1816.8338958.0
60000016122716.2516.1416.3216.13106658.0
60000017072113.6113.4513.6313.38522723.0
60000017082212.5112.4312.5312.41588299.0
6000041302187.747.77.787.6941981.0
6000041305096.936.826.946.7783294.0
6000041411079.469.259.59.18151350.0
6000041411139.949.810.069.77157928.0
60000415041513.9413.6614.2813.51218802.0
60000416051712.2912.2612.3712.1736444.0
60000416070112.2712.2812.3212.2425513.0
60000416083113.9813.814.0413.72102629.0
60000416112914.9415.0215.3514.8696846.0
6000051502093.143.143.173.08399554.0
6000051606132.862.812.872.8404585.0
6000051701203.743.743.773.72603146.0
6000061307052.812.812.852.7872694.0
6000061501305.995.866.055.8182827.0
6000061610277.87.87.857.7672917.0
6000061701266.796.856.866.7947302.0
6000061704246.56.326.516.3181167.0
6000061705056.136.16.186.0957066.0
60000712061510.710.7410.7910.572210.0
60000712081510.1710.0810.1710.011163.0
60000713051510.4410.610.6510.441999.0
6000071404049.669.689.739.5211349.0
60000714111012.812.8812.9112.6380727.0
60000714112513.0214.2914.2912.8205975.0
60000716012814.1814.3114.3813.8534519.0
60000716052418.4417.9518.4417.8127435.0
60000716081522.1523.7423.9622.1554745.0
60000716113020.5519.5920.6619.4372988.0
60000717020918.1618.2918.3518.0710078.0
6000081206135.15.165.25.0773556.0
60000815062417.318.018.1917.151196972.0
6000081605273.863.833.873.79155307.0
6000081710236.116.256.326.07679994.0
60000912032912.8512.8212.912.741977.0
60000913101415.5615.8716.3515.47446765.0
60000915112630.129.7430.1929.780731.0
60000917052239.739.8239.8738.854798.0
60000917061338.4938.6738.7138.058279.0
[mls@master bin]$ 

大数据开发技术Scala/sql进入方法总结

上一篇:Python : 创建字典的方法


下一篇:三层交换技术