Я пытаюсь подключить PySpark (с помощью Jupyter Notebook) к экземпляру базы данных Greenplum на Oracle VM VirtualBox через соединение JDBC, однако я получаю следующую ошибку, когда я ЗНАЮ, что пароль верный .:
Py4JJavaError: An error occurred while calling o424.load.
: org.postgresql.util.PSQLException: FATAL: password authentication failed
for user "user2"
Я пробовал:
Просмотр документации Greenplum DB относительно подключения к PySpark
Изменение настроек подключения Postgresql в файлах gp_hba.conf, sshd_conf и postgresql.conf
Использование оболочки pyspark и загрузка файла .jar как
pyspark --jars 'path to .jar file'
затем выполняется указанный код ниже
Код PySpark в блокноте Jupyter:
import findspark
findspark.init('spark-2.4.1-bin-hadoop2.7')
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
option = {
'url':"jdbc:postgresql://localhost:5432/tutorial",
'user':"user2",
'password':"SECRET",
'dbschema':"faa",
'dbtable':"otp_c",
'partitionColumn':"airlineid"
}
gpdf = spark.read.format('greenplum').options(**option).load()
Pivotal Greenplum инструктирует наличие файла .jar коннектора для соединения JDBC с базой данных, который я нашел в spark-2.4.1-bin-hadoop2.7 / jars / greenplum-spark_2.11-1.6.0.jar
Кроме того, в базе данных Greenplum файл gp_hba.conf настроен как:
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.
# CAUTION: Configuring the system for local "trust" authentication allows
# any local user to connect as any PostgreSQL user, including the database
# superuser. If you do not trust all your local users, use another
# authentication method.
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
# IPv4 local connections:
# IPv6 local connections:
local all gpadmin ident
host all gpadmin 127.0.0.1/28 trust
host all gpadmin 10.0.2.15/32 trust
host all gpadmin ::1/128 trust
host all gpadmin fe80::a00:27ff:fe84:1f3f/128 trust
local replication gpadmin ident
host replication gpadmin samenet trust
local gpperfmon gpmon md5
host all gpmon 127.0.0.1/28 md5
local tutorial +users trust
host tutorial +users trust
host all all 0.0.0.0/0 md5
#local all all md5
#local all user2 ident
Файл sshd_config настроен на
PasswordAuthentication yes
Наконец, файл postgresql.conf настроен на
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to '*', '*' = all
# (change requires restart)
port=5432 ##port = 5432 # sets the database
listener port for
# a Greenplum instance. The master and
# each segment has its own port
number.
# note: Port numbers for the Greenplum system must also be changed in the
# gp_configuration catalog. See the Greenplum Database Administrator Guide
# for instructions!
#
#
Я ожидаю подключения к Greenplum DB и выполнения SQL-запросов с PySpark, однако я получаю Py4JJavaError.
Не уверены, какие существуют другие варианты, в идеале я хочу подключиться через Jupyter Notebook, пожалуйста, помогите!