Apache Airflow Unable to fetch file over SFTP - sftp

I'm using the sftp_operator from Airflow v1.9rc5. I'm trying to fetch two files over SFTP but I'm getting:
ERROR - Failed connecting to host: 192.168.56.101, error: No authentication methods available
I have the connection ID set up for this remote host. I've also verified the connections from BASH using the SFTP command.
FTP fetch task:
sftp = SFTPOperator(
task_id='fetch_data',
ssh_conn_id='sftpid2',
local_filepath='/Users',
remote_filepath='/',
operation=SFTPOperation.GET,
dag=dag
)

The issue is that the UI was not updating the password field in the database for that connection ID. so when you tried to SFTP using user ID and PW, it would fail. If you updated the password field in that record, everything works as expected. So SFTP works with either SSH Key or UID and PW.

Related

How to copy files from local to hdfs using oozie

I am trying to copy files from my edge node to HDFS using oozie. Many suggested to setup password less ssh to get this done.
Iam unable to login to oozie user as it is a service user.
Is there any other way other than password less ssh.
Thanks in advance.
Other than password less ssh there are two more options :
1. My preferred option : Use JSch java library and create a java application which will accept a shell script to be executed as argument. Using the JSch , it will perform ssh on the configured edge node and execute the shell script on the edge node. In the jsch, you can configure, the edgenode username and password. Use 'JCEKS' file to store the password.
Then add a Java Action in Oozie to run the java application created using JSch.
2. Use "/usr/bin/expect" library to create a shell script, which will perform ssh on edgenode and then run the configured shell script. More details are here Use expect in bash script to provide password to SSH command

Default user: WSO2 Identity Server with Mariadb

I followed the steps defined in this link and restarted the WSO2 identity server.
When trying to login at https://localhost:9443/carbon using admin/admin credentials, it's giving me login failed message. Before changing the settings for WSO2, it was working with this credentials.
Obviously, that user is not present in MariaDB. Does anyone has any scripts to insert an admin user in WSO2 Maria DB for? I don't know what all tables I need to update in case of adding user manually. Or is there any other default user?
Kindly suggest.
Had the same problem, even switched to mysql community and it didn't fix it.
So with mysql installed I did the following, after MANY tries,
mysql -u root -p
create DATABASE regdb;
exit;
mysql -u root -p regdb < <WSO2_HOME>/dbscripts/mysql5.7.sql
mysql -u root -p regdb < <WSO2_HOME>/dbscripts/identity/mysql-5.7.sql
nohup <WSO2_HOME>/bin/wso2server.h -Dsetup &
If there is someplace to see the DB version, I haven't found it, but this got it all to working form me. So loading keep failing the DB because of some default time functions in the sql.
My $0.02

boxfuse dev db not provisioned correctly

I'm just starting with boxfuse and can't seem to find a way to get my dev database to be provisioned.
In my boxfuse.yml I have (for the database section):
database:
# the name of your JDBC driver
driverClass: com.mysql.jdbc.Driver
# the username
user: root
# the password
password: <password>
# the JDBC URL
url: jdbc:mysql://10.0.0.84:3306/dmsdb
# any properties specific to your JDBC driver:
properties:
charSet: UTF-8
hibernate.dialect: org.hibernate.dialect.MySQLInnoDBDialect
# the maximum amount of time to wait on an empty pool before throwing an exception
maxWaitForConnection: 1s
# the SQL query to run when validating a connection's liveness
validationQuery: "/* MyApplication Health Check */ SELECT 1"
# the minimum number of connections to keep open
minSize: 8
# the maximum number of connections to keep open
maxSize: 32
# whether or not idle connections should be validated
checkConnectionWhileIdle: false
If I try running it (boxfuse run), my application doesn't work at all.
boxfuse info produces the following:
oxfuse client v.1.18.7.938
Copyright 2016 Boxfuse GmbH. All rights reserved.
Account: mlr11 (mlr11)
Info about mlr11/dms-service in the dev environment:
App Type : Single Instance with Zero Downtime updates
App URL : http://127.0.0.1:8082
DB Type : MySQL database
DB URL : jdbc:mysql://localhost:3306/boxfuse-dev-db
DB Host : localhost
DB Port : 3306
DB Database : boxfuse-dev-db
DB User : boxfuse-dev-db
DB Password : boxfuse-dev-db
DB Status : available
Which is very different than what I was expecting. URL, Database, User, Password) are not matching my boxfuse.yml file.
What I am missing. I know it must be something simple. I did all kind of search and read the doc a few times. I can't seem to find what's wrong. Any pointers will be appreciated.
From the config file you posted I am assuming this is a dropwizard app.
Since your Boxfuse app was configured to use a MySQL database, Boxfuse automatically provisions a database in each environment when you first deploy your application there. In your case you can see the connection info for that database in the dev environment in the output you post in your question.
Boxfuse exposes these values (db url, user, password, ...) as environment variables (https://cloudcaptain.sh/docs/databases#envvars) and automatically configures your framework (Dropwizard I assume) to use those instead of the ones included in your config file. It will do so by passing -Ddw.database.url=$BOXFUSE_DATABASE_URL -Ddw.database.user=$BOXFUSE_DATABASE_USER -Ddw.database.password=$BOXFUSE_DATABASE_PASSWORD as arguments to the JVM.
Also doublecheck in the VirtualBox GUI that your VirtualBox installation is fully functional and able to start VMs and that both the Boxfuse Dev VM and the instance of your application are started properly.

Execute command in ubuntu terminal from an aspnet application

I have a command to drop postgresql database:
sudo -u myuser psql -c "drop database my_databse"
How I could execute this sentence from an aspnet website(c#)?
Is it possible to execute without introducing a password?
This app is running in another server:
I have a windows server running aspnet website.
I have an ubuntu server running postgresql database.
drop database my_databse is an SQL command. You can run it directly from nPgSQL. There is no need to run psql, and no point doing so.
If your usual user account doesn't have the access rights for it, you can make a new temporary connection in nPgSQL just for that command. You might find SET SESSION AUTHORIZATION or SET ROLE useful, too.

Failed scheduling a task involving linked servers with SQL Server Agent

How can I make a scheduled task work? I want to schedule a task that runs a query nightly. The query parses correctly and essentially grabs data from the SQL Server 2005 database on server2 and inserts the data into a table in a database on server1. The query and the task run on server1.
I am able to execute the query in Microsoft SQL Server Management Studio on server1. Using SQL Server Agent, I am able to create and schedule a job to execute the query but the job fails with the following error: Executed as user NT AUTHORITY\SYSTEM. Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' [SQLSTATE 28000] [Error 18456]. IT at my company speculates that I need to be added to the interactive logon list for server2, which is part of the policy.
I have Admin privileges on both server1 and server2, though the latter should not be necessary I think. Both server1 and server2 use Windows authentication, which I gather is set up upon installation of SQL Server.
Here is what I did. First I added server2 to sys.sysservers on server1 with the following command:
EXEC sp_addlinkedserver #server='server2'
Then I created a mapping between logins on server1 and server2 with: EXEC sp_addlinkedsrvlogin #rmtsrvname = 'server2', #useself = 'true'
That allowed me to to execute the query in Microsoft SQL Server Management Studio on server1. It worked. What I found to be curious was that the following didn’t work although "Command(s) completed successfully":
EXEC sp_addlinkedsrvlogin #rmtsrvname = 'server2', #useself = 'false', #locallogin = 'MYDOMAIN\myname', #rmtuser = 'myname', #rmtpassword = '*****'
(Note that real password is unencrypted because of Windows authentication.).
I got the error
Msg 18456, Level 14, State 1, Line 1
Login failed for user 'myname'.
A value of #useself = TRUE specifies that logins use their own credentials to connect to rmtsrvname, with the rmtuser and rmtpassword arguments being ignored. FALSE specifies that the rmtuser and rmtpassword arguments are used to connect to rmtsrvname for the specified locallogin. I would have expected both to work since what I specified for rmtuser and rmtpassword are exactly what I use to log in to the remote server directly.
The job always executes as the user specified in the Sql Server Agent service. If your service is running as LocalSystem, then you need to change your add linked server login to
EXEC sp_addlinkedsrvlogin #rmtsrvname = 'server2', #useself = 'false', #locallogin = 'NT AUTHORITY\SYSTEM', #rmtuser = 'myname', #rmtpassword = '*****'
If not localsystem, then specify whatever login used in the agent
Look at this discussion for more info http://www.sqlservercentral.com/Forums/Topic1003064-146-1.aspx#bm1003182

Resources